[X-Unix] awk

Stroller MacMonster at myrealbox.com
Wed Jan 7 12:46:38 PST 2004


On Jan 7, 2004, at 5:41 pm, Eugene Lee wrote:

> : There are annoying differences between "standard Unix" versions of 
> the
> : utilities and their GNU counterparts. Usually they Unix versions are
> : compatible with the GNU versions, but the GNU versions are not
> : compatible with the Unix versions.   ... Just as scripts written for
> : /bin/sh will work in /bin/ksh or /bin/bash ... scripts written for
> : either ksh or zsh will not run in sh.
>
> Too bad /bin/bash is the same as /bin/sh.  :-)

Excuse me if I missed the joke, but from `man bash`:

DESCRIPTION
        Bash  is  an  sh-compatible  command language interpreter that 
executes
        commands read from the standard input or from a file.  Bash also 
incor-
        porates useful features from the Korn and C shells (ksh and csh).
...

INVOCATION
...
        If  bash  is  invoked  with  the name sh, it tries to mimic the 
startup
        behavior of historical versions of sh as  closely  as  possible, 
  while
        conforming  to the POSIX standard as well.  When invoked as an 
interac-
        tive login shell, or a non-interactive shell with the  --login  
option,
        it  first  attempts  to read and execute commands from 
/etc/profile and
        ~/.profile, in that order.  The  --noprofile  option  may  be  
used  to
        inhibit  this  behavior.  When invoked as an interactive shell 
with the
        name sh, bash looks for the variable ENV, expands its value  if  
it  is
        defined,  and uses the expanded value as the name of a file to 
read and
        execute.  Since a shell invoked as sh does not attempt to read 
and exe-
        cute  commands from any other startup files, the --rcfile option 
has no
        effect.  A non-interactive shell invoked with  the  name  sh  
does  not
        attempt  to  read  any  other  startup files.  When invoked as 
sh, bash
        enters posix mode after the startup files are read.



More information about the X-Unix mailing list