Date: Wed, 25 Jan 2012 20:55:24 -0600 From: Doug Poland <doug@polands.org> To: Chuck Swiger <cswiger@mac.com> Cc: freebsd-questions@freebsd.org Subject: Re: Portability of shell scripts from other *nixes Message-ID: <912B3883-ABA1-4EE7-857B-CA8A55C8B506@polands.org> In-Reply-To: <28F1F479-EA39-4841-AE54-76F0E512C02B@mac.com> References: <ac1be76b3dd10516e61861ae253b793f.squirrel@email.polands.org> <28F1F479-EA39-4841-AE54-76F0E512C02B@mac.com>
next in thread | previous in thread | raw e-mail | index | archive | help
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. >>=20 >> 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. >=20 > Try using something like: >=20 > #!/usr/bin/env bash >=20 > (If the shell scripts are something written by Apple rather than by = third-parties, please also consider filing a bug report.) >=20 This gets me closer, but the scripts behave differently now on OS X. = For example, printf's don't output the same. =20 --=20 Regards, Doug
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?912B3883-ABA1-4EE7-857B-CA8A55C8B506>