Paul L. Snyder on 13 Oct 2009 15:39:55 -0700


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

Re: [PLUG] Distinguishing between environment variable with null value and one that is not set


On Wed, 14 Oct 2009, sean finney wrote:

> i hate to tell ya, but i'm pretty sure "[[" is also non-posix :)

Few things as a horrible in UNIX as trying to write portable shell scripts.
That's why I don't, I just give dubious advice.  I have good advice, too:
Don't try to write portable shell scripts. ;)

Indeed, '[[' is a reserved word with undefined behavior, as I should have
remembered.  The '[' command works, or its synonym 'test' (which needs a
subshell, so there you have it).

The relevant section of the POSIX spec, for those interested:
 
  http://www.opengroup.org/onlinepubs/009695399/utilities/toc.html

Paul
___________________________________________________________________________
Philadelphia Linux Users Group         --        http://www.phillylinux.org
Announcements - http://lists.phillylinux.org/mailman/listinfo/plug-announce
General Discussion  --   http://lists.phillylinux.org/mailman/listinfo/plug