From owner-freebsd-questions@FreeBSD.ORG Thu Jan 26 03:09:44 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 B6260106566B for ; Thu, 26 Jan 2012 03:09:44 +0000 (UTC) (envelope-from doug@polands.org) Received: from gilead.atchurch.org (h69-129-174-18.applwi.dedicated.static.tds.net [69.129.174.18]) by mx1.freebsd.org (Postfix) with ESMTP id 5AFDD8FC12 for ; Thu, 26 Jan 2012 03:09:44 +0000 (UTC) Received: from smtps.atchurch.org (smtps.atchurch.org [192.168.1.11]) by gilead.atchurch.org (8.14.4/8.14.4) with ESMTP id q0Q2tRn0059664; Wed, 25 Jan 2012 20:55:27 -0600 (CST) (envelope-from doug@polands.org) Received: from wloul19221.louisville.na.plexus.com (outbound.plexus.com [64.215.193.254]) (authenticated bits=0) by smtps.atchurch.org (8.14.4/8.14.4) with ESMTP id q0Q2c3ER000976 (version=TLSv1/SSLv3 cipher=AES128-SHA bits=128 verify=NO); Wed, 25 Jan 2012 20:38:05 -0600 (CST) (envelope-from doug@polands.org) Mime-Version: 1.0 (Apple Message framework v1084) Content-Type: text/plain; charset=us-ascii From: Doug Poland X-Priority: 3 (Normal) In-Reply-To: <28F1F479-EA39-4841-AE54-76F0E512C02B@mac.com> Date: Wed, 25 Jan 2012 20:55:24 -0600 Content-Transfer-Encoding: quoted-printable Message-Id: <912B3883-ABA1-4EE7-857B-CA8A55C8B506@polands.org> References: <28F1F479-EA39-4841-AE54-76F0E512C02B@mac.com> To: Chuck Swiger 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 03:09:44 -0000 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