On Jan 25, 2012, at 5:08 PM, Doug Poland wrote:

> Hello,
> 
> I'm trying port some shell scripts to FreeBSD that were originally
> written on Darwin (OS X).
> 
> The issue I'm having is the shebang line of the scripts in OS X is
> #!/bin/sh, and it turns out that is really an instance of bash, and
> the code contains some bashisms.  On FreeBSD I have bash in
> /usr/local/bin/bash.
> 
> Is there an "easy/best" way to have a single shebang that works on
> both OS's?  I'd rather not change FreeBSD's bourne shell to bash with
> any symlinking of /usr/local/bin/bash to /bin/sh.
> 
> 
> -- 
> Regards,
> Doug


Mac OS X defaults to /bin/bash but things get weird because sh on mac is also 
bash. Funnily enough a complete separate binary and not a symlink. Anyway, this 
means things written for the Mac may not work directly on FreeBSD. What I mean 
is that bash3 syntax is not going to be backwardly compatible with sh. If you 
wish to retain the bashiness of the scripts then the easiest option would be to 
install the bash (3.x) port and use env to invoke the appropriate shell on each 
system.

Regards,
Mikel King
BSD News Network
http://bsdnews.net
skype: mikel.king
http://twitter.com/mikelking



_______________________________________________
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to "freebsd-questions-unsubscr...@freebsd.org"

Reply via email to