Re: Shell script cleanups/style changes?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



David Kastrup wrote:
> Robert Schiele <rschiele@xxxxxxxxx> 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
-
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]

  Powered by Linux