Re: /usr/bin/env bash

Mark Brown <[email protected]> Tue, 17 Aug 2004 13:12:11 -0500
Newsgroups gmane.linux.lsb.discuss
Message-ID <OFD1AB67BC.E06F554E-ON86256EF3.006394F6-86256EF3.0063F894@us.ibm.com>
Mark Hatle writes:
> We use "#! /usr/bin/env bash" extensivly in our products.  Why?  because 

> we have absolutly no idea where on the system the user has installed 
bash.
> 
> By using /usr/bin/env bash, we ensure that bash is run based on the 
> users environment and not some hard coded (somewhat arbitrary location). 

>   Same could be said for /bin/sh.

This still requires a specification of exec() that includes it knowing 
what to
do with a file that starts with a "magic number" of "#!", and then how to
parse the following string...for example, having a whitespace char after
the "#!", is it really allowed? & etc. We found this hard to pin down
in POSIX/UNIXland.

But once you have that specified, you either have to define *exactly* 
where
the "standard shell" is located on the FS, or do the same with "env".


-------------------
Mark S. Brown 
STSM, UNIX/Linux OS Standards
IBM Systems Group, Linux Technology Center
[email protected]