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

Re: please fix your RC bugs



Steve Greenland <steveg@moregruel.net> writes:

> On 10-Aug-05, 13:38 (CDT), Philip Brown <phil@bolthole.com> wrote: 
>> > [1] Useful fragment for cross platform shell scripts:
>> > 
>> > #!/bin/sh
>> > # Do the Solaris Dance:
>> > if [ ! -d ~root ]  ; then
>> >     exec /usr/xpg4/bin/sh $0 "$@" 
>> > fi
>> > 
>> 
>> sigh.. okay, my "correction" had bugs, too :-)
>> better as
>> 
>> 
>> if [ ! -d ~root -a -x /usr/xpg4/bin/sh  ] ; then
>> 
>
> No, because that will let the script continue if there is no POSIX shell
> available. You want it to exit immediately, rather than randomly fail
> when you hit unsupported functionality.
>
> As a practical matter, any modern Solaris (>=7, probably even 2.6 and 2.5)
> machine has /usr/xpg4/bin/sh installed.
>
> Steve

But what if there is a /usr/xpg4/bin/sh that isn't posix? :)

MfG
        Goswin



Reply to: