From: Uwe Kleine-König Date: Fri, 03 Aug 2007 19:29:42 GMT Subject: Re: Shell script cleanups/style changes? Message-ID: <20070803192942.GA23432@informatik.uni-freiburg.de> In-Reply-To: <86sl72j9vn.fsf@lola.quinscape.zz> David Kastrup wrote: > Robert Schiele writes: > > > On Thu, Aug 02, 2007 at 12:44:22PM +0200, David Kastrup wrote: > >> ! logfile="${1#-?}" > > > > You can't do something like that on /bin/sh on many systems (for > > instance Solaris). > > Sigh. It's in Posix. Well Solaris is (kind of) Posix compliant---you need some extra effort to get it into Posix "mode": login@~ > uname -a SunOS login 5.10 Generic_125100-10 sun4u sparc login@~ > sh $ set tralala $ echo "${1#tra}" lala $ ^D the "problem" here is, that my PATH includes /usr/xpg4/bin before /usr/bin and that's non-standard (for Solaris). That is /usr/xpg4/bin/sh is Posix compliant and /usr/bin/sh is compatible to former versions of Solaris/SunOS and this one doesn't support these substitutions: login@~ > /usr/bin/sh $ set tralala $ echo "${1#tra}" bad substitution Having login@~ > ls -l /bin lrwxrwxrwx 1 root root 9 2006-07-03 09:29 /bin -> ./usr/bin sadly the Solaris sh is used for shell scripts that use a shebang line calling /bin/sh. Best regards Uwe -- Uwe Kleine-König http://www.google.com/search?q=5+choose+3