From owner-freebsd-questions@FreeBSD.ORG Thu Jan 26 00:04:28 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 C0AAA106566C for ; Thu, 26 Jan 2012 00:04:28 +0000 (UTC) (envelope-from cswiger@mac.com) Received: from asmtpout028.mac.com (asmtpout028.mac.com [17.148.16.103]) by mx1.freebsd.org (Postfix) with ESMTP id A6BA68FC1D for ; Thu, 26 Jan 2012 00:04:28 +0000 (UTC) MIME-version: 1.0 Content-transfer-encoding: 7BIT Content-type: text/plain; CHARSET=US-ASCII Received: from cswiger1.apple.com (unknown [17.209.4.71]) by asmtp028.mac.com (Oracle Communications Messaging Server 7u4-23.01 (7.0.4.23.0) 64bit (built Aug 10 2011)) with ESMTPSA id <0LYD003X5PJAA210@asmtp028.mac.com> for freebsd-questions@freebsd.org; Wed, 25 Jan 2012 16:04:28 -0800 (PST) X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10432:5.6.7361,1.0.211,0.0.0000 definitions=2012-01-25_10:2012-01-25, 2012-01-25, 1970-01-01 signatures=0 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 spamscore=0 ipscore=0 suspectscore=0 phishscore=0 bulkscore=0 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=6.0.2-1012030000 definitions=main-1201250285 From: Chuck Swiger X-Priority: 3 (Normal) In-reply-to: Date: Wed, 25 Jan 2012 16:04:22 -0800 Message-id: <28F1F479-EA39-4841-AE54-76F0E512C02B@mac.com> References: To: Doug Poland X-Mailer: Apple Mail (2.1084) Cc: freebsd-questions@freebsd.org Subject: Re: Portability of shell scripts from other *nixes X-BeenThere: freebsd-questions@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: User questions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 26 Jan 2012 00:04:28 -0000 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.) Regards, -- -Chuck