From owner-freebsd-questions@FreeBSD.ORG Thu Jan 26 00:03:23 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 852B1106564A for ; Thu, 26 Jan 2012 00:03:23 +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 396758FC17 for ; Thu, 26 Jan 2012 00:03:22 +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 600D75C5B for ; Thu, 26 Jan 2012 10:15:55 +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 F0EC35C58 for ; Thu, 26 Jan 2012 10:15:54 +1000 (EST) Message-ID: <4F209752.7090001@herveybayaustralia.com.au> Date: Thu, 26 Jan 2012 09:59:14 +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: In-Reply-To: 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 00:03:23 -0000 On 01/26/12 08:08, 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. Cant you simply change the shebang to !#/usr/local/bin/bash?