[olug] sed issues inside of a script

Dave Thacker dthacker9 at cox.net
Thu Nov 15 13:22:48 UTC 2007


On Tuesday 13 November 2007 18:53:40 Christopher Cashell wrote:
> On Nov 13, 2007 4:27 AM, Luke -Jr <luke at dashjr.org> wrote:
> > On Tuesday 13 November 2007, Christopher Cashell wrote:
> > > Also, using backticks is deprecated, so best practice would be to use
> > > $() in any new scripts that you write.
> >
> > IIRC, $() is a bashism and will not work in standard sh
>
> Nope, It's not a bashism, it's a POSIX shellism (and spec'ed in XPG4).
>  If I remember right, XPG4 was released in '92 or '93, so provided
> you're running a system that's not more than 10+ years old, you're
> most likely fine.  I will admit that there may be some systems out
> there that don't handle it properly (things that predate POSIX and the
> Single UNIX Specification), but back five years or so ago, I went
> through all of the systems I had access to, and it worked on all of
> them.  At that time, I decided to switch to using $() for all new
> scripts, and have yet to run into issues.

I suppose my 1998 copy of Kochan and Wood's Unix shell programming should be 
replaced then.....

DT
>
> If you're paranoid about it, however, you can always explicitely use
> bash (or ksh) to run your scripts.





More information about the OLUG mailing list