On 8/19/07, David Brodbeck <brodbd@u.washington.edu> wrote:
It certainly has its warts. In particular, Bash's "test" (aka "[")
operator has pitfalls. Testing for an empty variable, for example,
is awkward. If you do:
if [ $foo == "" ]
Bash will complain about missing arguments. Instead, you have to do
something like this:
if [ "x$foo" == "x" ]
which works, but makes no sense the first time you see it. The file-
testing features of "test" are quite powerful and extensive, though
-- there are few languages where it's quite so easy to test
conditions like, 'is this a directory?'.
Thanks. I copied this to my 'Bash-howto'.
Greetings, Manon.