From owner-freebsd-questions  Wed May  7 09:08:13 1997
Return-Path: <owner-questions>
Received: (from root@localhost)
          by hub.freebsd.org (8.8.5/8.8.5) id JAA29103
          for questions-outgoing; Wed, 7 May 1997 09:08:13 -0700 (PDT)
Received: from mail.EUnet.hu (www.eunet.hu [193.225.28.100])
          by hub.freebsd.org (8.8.5/8.8.5) with ESMTP id JAA29095
          for <freebsd-questions@freebsd.org>; Wed, 7 May 1997 09:08:08 -0700 (PDT)
Received: by mail.EUnet.hu, id SAA16547; Wed, 7 May 1997 18:07:57 +0200
Received: (from zgabor@localhost) by CoDe.hu (8.7.5/8.7.3) id QAA00750; Wed, 7 May 1997 16:49:41 +0200 (MET DST)
From: Zahemszky Gabor <zgabor@CoDe.hu>
Message-Id: <199705071449.QAA00750@CoDe.hu>
Subject: Re: string or int?
To: freebsd-questions@freebsd.org (FreeBSD questions)
Date: Wed, 7 May 1997 16:49:40 +0200 (MET DST)
Cc: un_x@anchorage.net
In-Reply-To: <Pine.BSF.3.95q.970506064528.10842A-100000@aak.anchorage.net> from Steve Howe at "May 6, 97 07:01:14 am"
X-Mailer: ELM [version 2.4ME+ PL11 (25)]
MIME-Version: 1.0
Content-Type: text/plain; charset=US-ASCII
Content-Transfer-Encoding: 7bit
Sender: owner-questions@freebsd.org
X-Loop: FreeBSD.org
Precedence: bulk

> 
> in regards to sh programming ...
> -------------------------------------------------------------------------
> "man test" says to use != and = for strings,
> and -ne and -eq for integers ...
> 
> many times, they appear to be interchangable ...
> what is the rule to determine whether your
> value is a string or an integer?

Your program.  Are you waiting for a numeric value, or not.

And what about this one:
$ test 01 = 1 ; echo $?
1
$ test 01 -eq 1 ; echo $?
0

Bye, Gabor
--
#!/bin/ksh
Z='21N16I25C25E30, 40M30E33E25T15U!' ;IFS=' ABCDEFGHIJKLMNOPQRSTUVWXYZ ';set $Z;for i { [[ $i = ? ]]&&print $i&&break;[[ $i = ??? ]]&&j=$i&&i=${i%?};typeset -i40 i=8#$i;print -n ${i#???};[[ "$j" = ??? ]]&&print -n "${j#??} "&&j=;typeset +i i;};IFS=' 0123456789 ';set $Z;X=;for i { [[ $i = , ]]&&i=2;[[ $i = ?? ]]||typeset -l i;X="$X $i";typeset +l i;};print "$X"