bug-coreutils
[Top][All Lists]
Advanced

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

Replacements for regular shell builtins


From: Eric Blake
Subject: Replacements for regular shell builtins
Date: Fri, 18 Feb 2005 07:14:23 -0700
User-agent: Mozilla Thunderbird 1.0 (Windows/20041206)

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

POSIX requires that all regular shell builtins (17 of them listed in XCU
1.13) be found by the exec() family, even though the behavior of these
utilities is restricted (for example, my recent complaint that /bin/pwd
can't set PWD in the calling environment) or a no-op (for example, a
/bin/fg would be in its own environment, with no background process that
can be brought to the foreground).

An example in XRAT was this use of cd, to invoke foo only on accessible
directories:
find . -type d -exec cd {} \; -exec foo {} \;

Solaris 8 provides executables in /usr/bin for all 17 regular shell
builtins, but currently, coreutils provides only false, kill, pwd, and
true.  Therefore, on other environments, like cygwin, the POSIX example
fails since cd is not found on PATH.

POSIX XRAT also mentions that the simplest implementation for finding
regular builtins via exec is to have each builtin utility also be the
8-byte file:
$0 "$@"
but this is pretty wimpy for a GNU application (what about --help and
- --version?).  Should the remaining regular shell builtins be provided by
coreutils, with some sort of sensible behavior?  These are alias, bg, cd,
command, fc, fg, getopts, jobs, newgrp, read, umask, unalias, and wait.
Also, remember that not all shells follow POSIX by providing all 17
regular built-ins; for example, ash does not have alias or unalias, and
bash does not have newgrp.

- --
Life is short - so eat dessert first!

Eric Blake             address@hidden
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.0 (Cygwin)
Comment: Public key at home.comcast.net/~ericblake/eblake.gpg
Comment: Using GnuPG with Thunderbird - http://enigmail.mozdev.org

iD8DBQFCFfg/84KuGfSFAYARAjMGAJ9klASnRCWWafIh+lbPnpr6zQhNXACfeaH8
0x7bf52b7Azw0R8wq+QS4IQ=
=Owmg
-----END PGP SIGNATURE-----




reply via email to

[Prev in Thread] Current Thread [Next in Thread]