[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: How do I make a portable test??
From: |
Dr. David Kirkby |
Subject: |
Re: How do I make a portable test?? |
Date: |
Fri, 14 Feb 2003 09:39:21 +0000 |
Eric Siegerman wrote:
>
> On Fri, Feb 14, 2003 at 02:11:37AM +0000, Dr. David Kirkby wrote:
> > "test: ==: unexpected operator" on a Sun running NetBSD 1.6
>
> "==" is indeed unexpected :-) Bourne shell doesn't support it; I
> don't believe ksh does either. It looks like a bash extension,
> in which shell it does pattern matching. (Even the standalone
> /usr/bin/test on my Mandrake 7.2 box doesn't support "=="; only
> bash's built-in "test" does.)
>
> Use "=" or "!=" for string comparison; for numeric comparison the
> operators are:
> -eq -ne -gt -ge -lt -le
Thanks, I assume then in this case I should be using -eq, since I am
comparing the numeric values of something - whether it is 0 or has
been incremented by one or two.
> > The section below between the two rows of stars works fine on a Sun
> > workstation running Solaris 9 (tcsh shell), a Sun workstation running
> > Debian Linux (bash shell), a PC running Redhat 7.3 Linux (tcsh shell),
>
> I bet the Solaris box has bash installed -- and as /bin/sh too!
> Linux systems typically have bash as /bin/sh, so the script's
> success there is unsurprising.
The Solaris box does indeed have bash installed, but it is NOT
/bin/sh. /bin/sh is unchanged from the default Sun installation. I do
however have a /usr/local/bin/test, which is possibly what is being
used on the Sun and not on the other system. I think I might delete
that, as there seem no way I can find out where it is from. It's a
binary, but does not respond to -v, -V, -h or any other switch I can
think of. Hence its origin is unknown. Perhaps best deleted.
Someone else wrote that bit of code on a Dec Alpha, which runs on his
system, although I don't know what OS he runs on it - probably Linux
though. I know he uses the bash shell, but whether that is /bin/sh on
his machine I have no idea.
> By "(tcsh shell)" I presume you mean it's your login shell.
> That's irrelevent; what matters is the one named in the script's
> "#!" line.
Yes, tcsh is my login shell - I keep meaning to change there seems to
a lot to suggest scsh/tcsh are not a good choice. However, the
configure script created has /bin/sh as the first line in it.
Would I be right in assuming there is some sense in temporarily
changing /bin/sh to point to different shells in order to check
portability?
--
Dr. David Kirkby,
Senior Research Fellow,
Department of Medical Physics,
University College London,
11-20 Capper St, London, WC1E 6JA.
Tel: 020 7679 6408 Fax: 020 7679 6269
Internal telephone: ext 46408
e-mail address@hidden
- How do I make a portable test??, Dr. David Kirkby, 2003/02/13
- Re: How do I make a portable test??, John Burger, 2003/02/13
- Re: How do I make a portable test??, Eric Siegerman, 2003/02/14
- Re: How do I make a portable test??,
Dr. David Kirkby <=
- Re: How do I make a portable test??, Eric Siegerman, 2003/02/14
- Re: How do I make a portable test??, Andreas Schwab, 2003/02/14
- Re: How do I make a portable test??, Thomas E. Dickey, 2003/02/14
- Re: How do I make a portable test??, Eric Siegerman, 2003/02/14
- Re: How do I make a portable test??, Bruce Korb, 2003/02/15
- Re: How do I make a portable test??, Eric Siegerman, 2003/02/17