Portability of shell scripts from other *nixes

Karl Vogel vogelke+unix at pobox.com
Thu Jan 26 04:52:17 UTC 2012

>> On Wed, 25 Jan 2012 16:08:07 -0600, 
>> "Doug Poland" <doug at polands.org> said:

D> I'm trying port some shell scripts to FreeBSD that were originally
D> written on Darwin (OS X).  The issue I'm having is the shebang line of
D> the scripts in OS X is #!/bin/sh, and it turns out that is really an
D> instance of bash, and the code contains some bashisms.  On FreeBSD I
D> have bash in /usr/local/bin/bash.

D> Is there an "easy/best" way to have a single shebang that works on both
D> OS's?  I'd rather not change FreeBSD's bourne shell to bash with any
D> symlinking of /usr/local/bin/bash to /bin/sh.

   Do you have the Korn shell installed?  I've found that to be a nice
   compromise for scripts that have bash-isms.

Karl Vogel                      I don't speak for the USAF or my company

Texted a friend meaning to ask if she was busy.
Me: "Are you busty?"  Her: "They're manageable, what's up?"
                     --Jimmy Fallon, #textingdisaster tweets, 13 Jan 2012

More information about the freebsd-questions mailing list