On Mon, Sep 01, 2008 at 01:00:10AM -0500, Terrence J. Doyle wrote:
> The $(id) and ${RANDOM} tests both give a false positive if ksh, bash or
> zsh is masquerading as sh. Nowadays, it's common to find that /bin/sh is
> actually bash and that there's no true Bourne Shell on the system.
What does "common" mean, if it's about _identifying_ a shell?
- Most commercial unix flavours come with a ksh88 as /bin/sh
(at least one is patched to behave different if called as sh [1])
- a few come with a Bourne shell as /bin/sh (Solaris, Tru64, OpenServer,
UnixWare)
- The free BSD variants and a few Linux distributions come with an ash variant,
- OpenBSD comes with pdksh.
Search a Usenetarchive about "whichshell" (by Brian Hiles or Stéphane Chazelas)
for ideas how to nail down the very variant by feature tests (which is the only
way you can rely on, anyway).
[1] ksh88f from IRIX 6.4 on, when called as "sh" (and if $_XPG is
not set to something greater 0), disables several of its korn shell
extensions, like $() and $(()) and falls back to Bourne about the
behaviour of several built-ins. ksh integer variables are also affected.
It's not intended as a complete Bourne shell emulation, but apparently
should have eased the move from Bourne to Korn shell as new system shell
from this version on.
_______________________________________________
ast-users mailing list
[email protected]
https://mailman.research.att.com/mailman/listinfo/ast-users