On Wed, 17 Aug 2005, Johnny C. Lam wrote: > (3) Solaris /bin/sh fix: don't set and export in one command; > rather, export all the variables after setting them. > > (4) Solaris /bin/sh fix: "if ! cmd ; then ... fi" isn't understood, > so change it to "if cmd; then :; else ... fi".
These are no "fixes", but workarounds for a truly rotten and unusable /bin/sh on Solaris. Sun should have replaced /bin/sh by something POSIX compliant by now... Solaris however ships with a decent shell, namely /usr/xpg4/bin/sh, also known as /usr/bin/ksh. The XPG4 manual page on Solaris suggests putting /usr/xpg4/bin and /usr/ccs/bin up front in the path, and that is what Solaris systems should do. Solaris' XPG4 sh and ksh understand both "export VAR=value" and "if ! cmd1 ; then cmd2 ; fi", here are my tests (Solaris 8 SPARC): SHELL=/usr/xpg4/bin/sh $SHELL -c 'if ! false ; then echo true ; fi' $SHELL -c 'export A=test ; echo $A' Both tests pass, and both fail with SHELL=/bin/sh. We can lift auto* magic to get this working on Solaris from bogofilter if desired for #! lines. -- Matthias Andree