unknown operand in ash

Alexander Griesser alexander.griesser at lkh-vil.or.at
Fri Apr 21 08:07:03 UTC 2006


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Hi folks!

I wrote a small shell script for CGI Post Method handling and one part
of this script is this line:

[ "$REP" = "%" ] && REP="%%"

This works fine, as long as $REP is not "!".

[lxtc - ~ #] REP=%
[lxtc - ~ #] [ "$REP" = "%" ] && echo test
test
[lxtc - ~ #] REP=x
[lxtc - ~ #] [ "$REP" = "%" ] && echo test
[lxtc - ~ #] REP=!
[lxtc - ~ #] [ "$REP" = "%" ] && echo test
[: %: unknown operand
[lxtc - ~ #]

According to ash.c this happens because ash thinks that the leading
! has to be used as operand.

For the meantime, I helped my self out by modifying the line to the
following statement:

[ "x$REP" = "x%" ] && REP="%%"

I just wanted to point this out, maybe one of you with the specific
knowledge of ash.c can fix that.

ciao,
- --
Alexander Griesser (Netzwerkadministration)
E-Mail: alexander.griesser at lkh-vil.or.at | Web: http://www.lkh-vil.or.at
KABEG LKH Villach | Nikolaigasse 43 | 9500 Villach
Tel.:   +43 4242 208 3061 | Fax.:   +43 4242 971 3061
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.3 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iD8DBQFESJKn66HVD6KUm1oRAkygAKCi3FUsLYMN9BNFi7oa2AJBzCRDwQCfVPLd
NGl6OYRA/naqyfURDmZRbqM=
=OgBo
-----END PGP SIGNATURE-----



More information about the busybox mailing list