Re: shell



On 21 Mar 2006 14:51:02 -0800, saghster wrote:
Well i've problem about the shell in solaris with
linux(freebsd-fedora-debian), the question is what is the diferent in
this shell, and your complegity...?
[...]

The sh in /bin in Solaris is not a Unix shell, it's a
Bourne shell (a shell from the old age), only there for backward
compatibility for old scripts.

The Unix shell on Solaris is in /usr/xpg4/bin.

Solaris is a bit annoying with that as it chose to keep the
deprecated stuff in the usual place (/bin, /usr/bin). You get
similar problems with sed, awk, tr... You must issue a
PATH=$(getconf PATH):$PATH to have Solaris behave in a more Unix
(as in "conformant to the modern Unix specifications") way (the
default PATH is generally configured so that the old tools are
used instead of the new ones).

To write a Unix/POSIX conformant script portable to Solaris, you
generally have to do something like:

#! /bin/sh -

# ensure `Unix' shell for Solaris
false ^ true && [ -x /usr/xpg4/bin/sh ] && exec /usr/xpg4/bin/sh - "$0" ${1+"$@"}

# ensure `Unix' utilities
PATH=$(command -p getconf PATH; :):$PATH
export PATH

If you need to port the script to some other system that also
chose to have the standard tools in some unusual place, you'll
probably need to adapt that preamble.
--
Stephane
.



Relevant Pages

  • Re: [ Attn: Randy ] Ad-hoc Parsing?
    ... > therefore you loose the primary advantage of writing a script and may ... > matching Unix. ... You use six external programs ('tidy', 'make-make', ... program and not by the shell, ...
    (alt.lang.asm)
  • Re: How to get the application path
    ... Why do you limit this to "Unix"? ... shell process waiting until the the binary proper returns. ... Could you tell me the equivalent of my script in CMD.exe? ... installation location in the registry and how I ...
    (comp.lang.ada)
  • Re: [ Attn: Randy ] Ad-hoc Parsing?
    ... > within the script whereas sed.exe is a separate file on ... > when the external program is available). ... >>Because the Windows shell has inadequate quoting facilities. ... One can in Unix. ...
    (alt.lang.asm)
  • Re: How to get the application path
    ... Why do you limit this to "Unix"? ... shell process waiting until the the binary proper returns. ... Could you tell me the equivalent of my script in CMD.exe? ... Application paths in Windows are supposed to be set in the registry; ...
    (comp.lang.ada)
  • comp.unix.shell FAQ - Answers to Frequently Asked Questions
    ... It spells "unix" in lower case letters ... The other level is how to write shell scripts. ... than standard unix utilities, it should be included in this FAQ. ... How do I get a script to update my current environment? ...
    (comp.unix.shell)