[X-Unix] Hiding apps from the command line

Stroller MacMonster at myrealbox.com
Fri Mar 26 16:21:59 PST 2004


On Mar 26, 2004, at 7:40 pm, Eugene Lee wrote:

> On Fri, Mar 26, 2004 at 05:04:34PM +0000, Stroller wrote:
> :
> : On Mar 26, 2004, at 12:15 pm, Eugene Lee wrote:
> : >
> : >: #! /bin/sh
> : >
> : >No spaces here, it should be "#!/bin/sh" (without the quotes).
> :
> : It's probably more elegant to use #!/bin/bash at the beginning of 
> your
> : scripts, as we don't actually have a Bourne shell on our Macs.
>
> True, but not everyone has /bin/bash.  Some have /usr/local/bin/bash.
> /bin/sh is guaranteed to be more portable.

You're using applescript in scripts that are intended to be 
portable..?!?

> : In
> : additional to its superset of commands `bash` does, I believe, behave
> : slightly differently from traditional `sh`; if invoked as `sh` Bash
> : _should_ behave as `sh`, however I am not aware that this has been
> : demonstrated. [1]
>
> Actually, the binary does behave differently according to the man page:
>
> 	...
>        If  bash  is  invoked  with  the name sh, it tries to mimic the 
> startup
>        behavior of historical versions of sh as  closely  as  
> possible...

I quoted that already - see my posting of January 7, 2004 8:46:38 pm 
GMT.

What I perhaps should have said in my reply to you earlier today is that
   "..if invoked as `sh` Bash _should_ behave exactly as `sh`, however I 
am not aware that this has been fully demonstrated. IE: I was unable to 
provide evidence that GNU bash is bug-free in this respect.

>        If  bash  is  invoked  with  the name sh, it tries to mimic the 
> startup
>        behavior of historical versions of sh as  closely  as  
> possible,  while
>        conforming  to the POSIX standard as well.

The word "tries" is also very telling in the quoted statement, as is 
"whilst behaving to the POSIX standard". What does Bash do if there's a 
conflict between sh's behaviour & the POSIX standard..?

The rest of your quote from the manpage deals with startup options, 
about reading initialisation files on startup, but doesn't seem to 
specify how bash deals with commands that have different syntax (or do 
not exist) in the Bourne shell, if invoked as /bin/sh.

Believe me, I would have liked nothing more than to be able to 
demonstrate, in reply to William H. Magill's posting of January 8, 2004 
8:49:14 pm GMT, that Bash does in fact behave correctly when invoked as 
`sh`, but I Googled for over an hour and was unable to find anything 
confirming that it does.

Stroller.



More information about the X-Unix mailing list