Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 25 Jan 2012 20:13:33 -0800
From:      Chuck Swiger <cswiger@mac.com>
To:        freebsd-questions@freebsd.org
Subject:   Re: Portability of shell scripts from other *nixes
Message-ID:  <8E97D656-0FC1-4DD5-9F94-6707823F9F12@mac.com>
In-Reply-To: <4F20C759.7060508@herveybayaustralia.com.au>
References:  <ac1be76b3dd10516e61861ae253b793f.squirrel@email.polands.org> <28F1F479-EA39-4841-AE54-76F0E512C02B@mac.com> <912B3883-ABA1-4EE7-857B-CA8A55C8B506@polands.org> <4F20C759.7060508@herveybayaustralia.com.au>

next in thread | previous in thread | raw e-mail | index | archive | help
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




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?8E97D656-0FC1-4DD5-9F94-6707823F9F12>