If this is the wrong group for this question can you please tell me who
to ask?
Isn't
[-n string]
and
[string]
supposed to evaluate to exactly the same thing?
When I run the following script:
#!/bin/sh
if [ -n $1 ]
then
echo Foo
fi
# end of script
it echoes "Foo" regardless of whether there's a first parameter or not.
#!/bin/sh
if [ $1 ]
then
echo Foo
fi
# end of script
on the other hand, only echoes "Foo" if the script is presented with a
parameter.
Why is this?
Thanx in advance.
/Per Fransson