|
From: | mwoehlke |
Subject: | Re: Bug with 'test' built-in. |
Date: | Thu, 10 Aug 2006 10:49:28 -0500 |
User-agent: | Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.8.0.5) Gecko/20060719 Thunderbird/1.5.0.5 Mnenhy/0.7.4.0 |
Paul Jarc wrote:
mwoehlke <mwoehlke@tibco.com> wrote:I *know* '! [ -a file ]' is not portable. I tried to use it in some script, somewhere, at some time, and it was sometimes treated as history expansion.Quoting the "!" would take care of that particular problem, but there are some older shells, like Solaris /bin/sh, where the "!" command doesn't exist at all, so if this script will have to run in anything but bash, it'd still be good to use one of the other methods.
Hehe, yeah, I have to maintain scripts that run under "/bin/sh" on... oh, about nine different platforms. :-) That's always a frustrating exercise in portability, and not just w.r.t. the shell. For instance, there is one script that breaks with certain non-GNU versions of 'awk' and 'tail', and there have been plenty of times I've put in conditional code. Heck, I've even done conditional code based on the version of bash! :-)
-- Matthew vIMprove your life! Now on version 7!
[Prev in Thread] | Current Thread | [Next in Thread] |