From owner-freebsd-questions@FreeBSD.ORG Thu Jan 26 03:28:19 2012 Return-Path: Delivered-To: freebsd-questions@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 9640A1065670 for ; Thu, 26 Jan 2012 03:28:19 +0000 (UTC) (envelope-from freebsd-questions@herveybayaustralia.com.au) Received: from mail.unitedinsong.com.au (mail.unitedinsong.com.au [150.101.178.33]) by mx1.freebsd.org (Postfix) with ESMTP id 472688FC08 for ; Thu, 26 Jan 2012 03:28:19 +0000 (UTC) Received: from mail.unitedinsong.com.au (bell.herveybayaustralia.com.au [192.168.0.40]) by mail.unitedinsong.com.au (Postfix) with ESMTP id 4DE045C55 for ; Thu, 26 Jan 2012 13:40:51 +1000 (EST) Received: from laptop1.herveybayaustralia.com.au (laptop1.herveybayaustralia.com.au [192.168.0.179]) (using TLSv1 with cipher DHE-RSA-CAMELLIA256-SHA (256/256 bits)) (No client certificate requested) by mail.unitedinsong.com.au (Postfix) with ESMTPSA id 7370D5C45 for ; Thu, 26 Jan 2012 13:40:50 +1000 (EST) Message-ID: <4F20C759.7060508@herveybayaustralia.com.au> Date: Thu, 26 Jan 2012 13:24:09 +1000 From: Da Rock User-Agent: Mozilla/5.0 (X11; FreeBSD amd64; rv:7.0.1) Gecko/20111109 Thunderbird/7.0.1 MIME-Version: 1.0 To: freebsd-questions@freebsd.org References: <28F1F479-EA39-4841-AE54-76F0E512C02B@mac.com> <912B3883-ABA1-4EE7-857B-CA8A55C8B506@polands.org> In-Reply-To: <912B3883-ABA1-4EE7-857B-CA8A55C8B506@polands.org> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Subject: Re: Portability of shell scripts from other *nixes X-BeenThere: freebsd-questions@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list Reply-To: freebsd-questions@freebsd.org List-Id: User questions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 26 Jan 2012 03:28:19 -0000 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.