From owner-freebsd-questions@FreeBSD.ORG Thu Jan 26 04:14:07 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 534B6106566C for ; Thu, 26 Jan 2012 04:14:07 +0000 (UTC) (envelope-from cswiger@mac.com) Received: from asmtpout025.mac.com (asmtpout025.mac.com [17.148.16.100]) by mx1.freebsd.org (Postfix) with ESMTP id 380C48FC0A for ; Thu, 26 Jan 2012 04:14:06 +0000 (UTC) MIME-version: 1.0 Content-transfer-encoding: 7BIT Content-type: text/plain; CHARSET=US-ASCII Received: from [10.1.2.144] (unknown [173.200.178.70]) by asmtp025.mac.com (Oracle Communications Messaging Server 7u4-23.01 (7.0.4.23.0) 64bit (built Aug 10 2011)) with ESMTPSA id <0LYE00H2U12MKW40@asmtp025.mac.com> for freebsd-questions@freebsd.org; Wed, 25 Jan 2012 20:13:35 -0800 (PST) X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10432:5.6.7361,1.0.211,0.0.0000 definitions=2012-01-26_01:2012-01-26, 2012-01-26, 1970-01-01 signatures=0 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 spamscore=0 ipscore=0 suspectscore=3 phishscore=0 bulkscore=0 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=6.0.2-1012030000 definitions=main-1201250373 From: Chuck Swiger In-reply-to: <4F20C759.7060508@herveybayaustralia.com.au> Date: Wed, 25 Jan 2012 20:13:33 -0800 Message-id: <8E97D656-0FC1-4DD5-9F94-6707823F9F12@mac.com> References: <28F1F479-EA39-4841-AE54-76F0E512C02B@mac.com> <912B3883-ABA1-4EE7-857B-CA8A55C8B506@polands.org> <4F20C759.7060508@herveybayaustralia.com.au> To: freebsd-questions@freebsd.org X-Mailer: Apple Mail (2.1084) 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 04:14:07 -0000 Hi-- On Jan 25, 2012, at 7:24 PM, Da Rock wrote: > On 01/26/12 12:55, Doug Poland wrote: >> 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. /bin/sh on MacOSX is: $ /bin/sh --version GNU bash, version 3.2.48(1)-release (x86_64-apple-darwin10.0) Copyright (C) 2007 Free Software Foundation, Inc. ...and it has been using bash as /bin/sh since 10.2 or so. Anyway, running bash as /bin/sh versus as /bin/bash likely affects whether it invokes printf as a builtin(1) command or as an external command. It's possible that invoking /usr/bin/printf instead of just printf in the scripts might resolve the issue(s). Regards, -- -Chuck