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

Re: RFC: use readable $(cmd) syntax instead of unreadable `cmd`

On 11-Feb-07, 13:40 (CST), Russ Allbery <rra@debian.org> wrote: 
> Steve Greenland <steveg@moregruel.net> writes:
> > Then you have a lot more problems than `` vs $(). Debian's (and pretty
> > much everybody elses) /bin/sh is POSIX, and allows any valid POSIX
> > construct. Solaris's /bin/sh is ancient Bourne shell, and doesn't
> > support a whole lot of stuff in common use.
> Yup.  You get very used to writing in the restricted common subset when
> you have software that has to work on Solaris /bin/sh, but remembering
> what's allowed and what isn't is complex enough that it's a lot easier to
> write *all* your shell scripts in that restricted common subset and be
> sure.

I gave up trying to keep track. Instead, I use this fragment at the
beginning of scripts that need to run on Solaris so they have a POSIX

# Do the solaris dance to get a real shell.
if [ ! -d ~root ]  ; then
    if exec /usr/xpg4/bin/sh $0 "$@" ; then
        echo "No POSIX shell available, call support";

(That's right, Solaris /bin/sh doesn't support the "~user" notation.
There's probably a cheaper test, but this has worked for me.)

After this, use all the functions you want :-)


Steve Greenland
    The irony is that Bill Gates claims to be making a stable operating
    system and Linus Torvalds claims to be trying to take over the
    world.       -- seen on the net

Reply to: