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

According to Doug McIlroy on 3/7/2008 7:17 PM:
| These two bash sequences are not equivalent.
| My intuition and the bash man page tell me they should be the same.
|
|   % export X=x; time --version; unset X
|   -bash: --version: command not found
|
|   % unset X; X=x time --version
|   GNU time 1.7

Thanks for the report.  However, I don't think this is a bug.  On many
platforms, time is both a bash reserved word, as well as a binary
application.  POSIX states this as an informative note:

"In the KornShell, time is a shell reserved word that can be used to time
an entire pipeline, rather than just a simple command. The POSIX
definition has been worded to allow this implementation."

The difference in behavior is because this is the implementation that bash
chose - unlike all other bash builtins (which are not reserved words),
time is recognized as the bash version ONLY if it is the first word of a
simple command; using a variable assignment bypasses the reserved word
recognition and defers to the binary application.

Try these
unset X; time X=x --version
export X=x; /bin/time --version; unset X

for comparison.

- --
Don't work too hard, make some time for fun as well!

Eric Blake             [EMAIL PROTECTED]
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.5 (Cygwin)
Comment: Public key at home.comcast.net/~ericblake/eblake.gpg
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iD8DBQFH0goS84KuGfSFAYARAiXJAKDCwLAGNxEReoh3cnFufAeZLnQT6ACgxexq
MBpXAs0R5DQ3+EFaSH/Hkc0=
=nb0e
-----END PGP SIGNATURE-----


Reply via email to