On 10/1/07, Bill McGonigle <[EMAIL PROTECTED]> wrote:
>> What I'm saying is #!/bin/sh should run like #!/bin/sh.  export
>> VAR=value doesn't work in bourne shell.  So if you put that in a bourne
>> shell script with #!/bin/sh, then it should fail
>
> That seems to be the root cause of the problem, IMHO.  Bash is
> _supposed to_ run in POSIX/Bourne-shell mode when invoked as /bin/sh,
> right?

  I think the root cause is that there isn't any "POSIX shell" or
"Bourne shell" standard, in the way that we usually think of the word
"standard".  Even the Bourne shell evolved over time, although I don't
know to what degree.  Later on, just about everybody tweaked their
shell at least a little bit (or maybe a lot).  The POSIX "standard"
reflects this, in its range of acceptable behavior.  It can be argued
that POSIX was more about inventing a standard that fit existing
implementations, rather than the other way around.  So there's nothing
"standard" about the whole thing.

  bash takes it to an extreme, to be sure, but it's really just
continuing the trend.

  So I guess my point is: Saying "#!/bin/sh should run like #!/bin/sh"
is largely meaningless, because there is no agreed-upon definition for
what "run like #!/bin/sh" means.

  Come to think of it, bash added features over time, too.  So I guess
what we really should be doing is putting

        #/bin/bash-3.1-CentOS-5-build-16.1

at the top of all our shell scripts.  Right?

> The man page says:
>> When invoked as sh, bash enters posix mode after the startup files are read.

  I looked up the same thing last night.  Looking at the man page, the
*only* thing "POSIX mode" is reported to do is change the startup
files bash uses.  There's nothing in that doc about changing other
behaviors.  Whether that makes it a "feature" or simply a "documented
bug" is a mostly semantic distinction.

-- Ben
_______________________________________________
gnhlug-discuss mailing list
gnhlug-discuss@mail.gnhlug.org
http://mail.gnhlug.org/mailman/listinfo/gnhlug-discuss/

Reply via email to