Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 7 May 1997 17:17:12 +0200 (MET DST)
From:      Zahemszky Gabor <zgabor@CoDe.hu>
To:        freebsd-questions@freebsd.org (FreeBSD questions)
Cc:        un_x@anchorage.net
Subject:   Re: test
Message-ID:  <199705071517.RAA00837@CoDe.hu>
In-Reply-To: <Pine.BSF.3.95q.970506221207.18627A-100000@aak.anchorage.net> from Steve Howe at "May 6, 97 10:17:43 pm"

next in thread | previous in thread | raw e-mail | index | archive | help
> 
> if [ $1 != "-a" -a $1 != "-b" -a $1 != "-p" ]; then blah; blah; blah; fi
> -------------------------------------------------------------------------
> shouldn't test be able to handle this, for simple option checking?
> i think "test" gets confused and chokes because it thinks
> "-a", "-b", "-p" are "test" options.
> 
> i doesn't seem like there is any way to "quote" out the options i'd like
> to test so that test doesn't think they are its own ...
> 
> is there?

It would be better to put "s around $1, and the trick is the next:
if [ "X$1" != "X-a" -a "X$1" != "X-b" -a "X$1" != "X-p" ]; then blah; blah; blah; fi

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"



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?199705071517.RAA00837>