[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: /bin/sh diversions

[Pierre Habouzit]
>   the 3 biggest problems I've seen are:
>   * [[ for test, trivial: add it as a test alias, and also check for ]]
>     termination in the test.c builtin.

Ummm, [[ is not the same as [.  (If they were the same, there would
have been no need to invent [[.)  They behave quite differently with
regard to argument quoting.  Try this in bash:

  unset foo
  [ -n $foo ] && echo foo is non-empty
  [[ -n $foo ]] && echo foo is non-empty

As you can see, only the second one works.
Peter Samuelson | org-tld!p12n!peter | http://p12n.org/

Attachment: signature.asc
Description: Digital signature

Reply to: