microsky
MIS
- May 7, 2001
- 33
Please see following K shell command, in the IF statement, why the result is same when use "-z" and "-n" parameter?
$ set |grep SHELL
SHELL=/bin/ksh
$ set |grep FILE_NAME
FILE_NAME=''
$ if [ -n $FILE_NAME ] ;
> then
> echo "fa"
> fi
fa
$ if [ -z $FILE_NAME ] ;
> then
> echo "fa"
> fi
fa
$
$ set |grep SHELL
SHELL=/bin/ksh
$ set |grep FILE_NAME
FILE_NAME=''
$ if [ -n $FILE_NAME ] ;
> then
> echo "fa"
> fi
fa
$ if [ -z $FILE_NAME ] ;
> then
> echo "fa"
> fi
fa
$