[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: exported SHELLOPTS gives error message from sh
From: |
Chet Ramey |
Subject: |
Re: exported SHELLOPTS gives error message from sh |
Date: |
Mon, 10 Oct 2011 11:56:31 -0400 |
> On Mon, Oct 10, 2011 at 11:06:16AM -0400, Len Giambrone wrote:
> > I understand that. But if you change all your scripts to use
> >
> > #!/bin/bash
> > instead of
> > #!/bin/sh
> >
> > your scripts will fail when bash isn't installed.
>
> If you use bash features in your script, then you must ensure that the
> script is executed by bash, and not by /bin/sh. There are many ways you
> can accomplish this:
Len is using Mac OS X (darwin), which does have bash-3.2 installed as
/bin/sh. He may have upgraded that to bash-4.1 or bash-4.2. I haven't
looked at his report in detail yet, but I suspect the majority of the
problems are the result of bash being Posix-conformant when called as
/bin/sh. Depending on when that matters -- initialization, startup
files, executing scripts -- he may be able to get around it by running
`set +o posix'. As I said, I'll have to look at it more closely.
Chet
--
``The lyf so short, the craft so long to lerne.'' - Chaucer
``Ars longa, vita brevis'' - Hippocrates
Chet Ramey, ITS, CWRU chet@case.edu http://cnswww.cns.cwru.edu/~chet/