Doug McIlroy wrote:
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
They are not the same, and should not be treated identically.  Bash
implements `time' as a reserved word, not a builtin.  Reserved words
are recognized by the grammar only in specific circumstances, and
following an assignment statement isn't one of them.

I implemented it as a reserved word to allow pipelines, and to a
lesser extent, shell builtins, to be timed.  There's really no reason
to ever implement it as a regular builtin -- people just don't time
builtins very often, and that's the only thing making it a builtin
would buy you.

Bash's implementation of time conforms to Posix, which explicitly
allows it to be a reserved word.  However, it is possible, and fairly
easy, to configure bash without support for command timing.

Chet

--
``The lyf so short, the craft so long to lerne.'' - Chaucer
                       Live Strong.  No day but today.
Chet Ramey, ITS, CWRU    [EMAIL PROTECTED]    http://cnswww.cns.cwru.edu/~chet/


Reply via email to