[olug] sed issues inside of a script

Christopher Cashell topher-olug at zyp.org
Wed Nov 14 00:53:40 UTC 2007


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.

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

-- 
Christopher



More information about the OLUG mailing list