Portability of shell scripts from other *nixes
Da Rock
freebsd-questions at herveybayaustralia.com.au
Thu Jan 26 03:28:19 UTC 2012
On 01/26/12 12:55, Doug Poland wrote:
> On Jan 25, 2012, at 18:04 , Chuck Swiger wrote:
>
>> On Jan 25, 2012, at 2:08 PM, Doug Poland wrote:
>>> 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.
>> Try using something like:
>>
>> #!/usr/bin/env bash
>>
>> (If the shell scripts are something written by Apple rather than by third-parties, please also consider filing a bug report.)
>>
> This gets me closer, but the scripts behave differently now on OS X. For example, printf's don't output the same.
>
Try searching on google and find out exactly what sh MacOSX is using.
Then you'd have a better idea on what you're working with.
More information about the freebsd-questions
mailing list