wuha, i am sorry to say that, but what i wrote was mostly wrong :( it's just too simple. i didn't saw cause i assumed to deal with a strange situation. but this is just normal behaviour. you wrote:
> $echo $? returns 0 after these test commands. > > $test -z "" > $test -z first of all. my biggest mistake ;) test isn't a shell builtin but a /usr/bin command. but doesn't really matter. so what do you know about test after this first to commands? that it works correctly, because "" is an empty string an '-z' tests for empty strings. than you also know, that the 'test' is programmed in that way, that it returns a '0' if an option but no argument is given. you see this in the manpages (man test): test EXPRESSION [ EXPRESSION ] test OPTION you see that EXPRESSION is in [ ] brackets. means it is optional - no error - therefor exit code '0' ;). i had to read thru the manpage many times carefully too until i saw it. just looked to far to see the obvious. after you understood this, the rest explains it self: > > But it returns different value after followings. > > $test -n "" -- echo$? returns 1 > $test -n -- " " 0 > "" is an empty string, but '-n' tests for a not empty string. i know it's a brain sucker, but think about mathematicly. what is an not empty string? a string with something inside. so... "string" is 'not empty', here would '-n' return with 0. but "" is empty, it is not an 'not empty' string. therefor '-n' returns 1. while i was writing this, i remembered that i did fallen already once into this. funny unix is, isnt it? luv it ;) have phun B) miLosh -- DONT ATTACK IRAQ !!! this message was sent by: +------------------------------+ |.::|[ The pleXus Network ]|::.| +------------------------------+ www: plexus.shacknet.nu | ftp: plexus.shacknet.nu +-------------------+ irc: plexus.shacknet.nu:6667 channel: #plexus | +--------------------------------------------------+-----------+ pub 1024D/C944D699 miLosh (pleXus) <[EMAIL PROTECTED]> \_____ Key fingerprint = 18FB 24BA 77A8 813F 6A8C F67B C08C 5A76 C944 D699 \ +----------------------------------------------------------------------+
msg63125/pgp00000.pgp
Description: PGP signature
