bug-bash
[Top][All Lists]
Advanced

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

Re: TIMEFORMAT bug


From: Pierre Gaston
Subject: Re: TIMEFORMAT bug
Date: Fri, 20 Mar 2009 09:38:39 +0200

On Fri, Mar 20, 2009 at 8:36 AM, Марк Коренберг <socketpair@gmail.com> wrote:
> Configuration Information [Automatically generated, do not change]:
> Machine: i486
> OS: linux-gnu
> Compiler: gcc
> Compilation CFLAGS:  -DPROGRAM='bash' -DCONF_HOSTTYPE='i486'
> -DCONF_OSTYPE='linux-gnu' -DCONF_MACHTYPE='i486-pc-linux-gnu'
> -DCONF_VENDOR='pc' -DLOCALEDIR='/usr/share/locale' -DPACKAGE='bash'
> -DSHELL -DHAVE_CONFIG_H   -I.  -I../bash -I../bash/include
> -I../bash/lib   -g -O2 -Wall
> uname output: Linux mmarkk-desktop 2.6.27-11-generic #1 SMP Thu Jan 29
> 19:24:39 UTC 2009 i686 GNU/Linux
> Machine Type: i486-pc-linux-gnu
>
> Bash Version: 3.2
> Patch Level: 39
> Release Status: release
>
> Description:
>        TIMEFORMAT variable improperly handled
>
> Repeat-By:
>        $ TIMEFORMAT='test'; time echo aaa
>        aaa
>        test
>        (works OK, but:)
>
>        $ TIMEFORMAT='test' time echo aaa
>        outputs something like this:
>        aaa
>        0.00user 0.00system 0:00.00elapsed 200%CPU (0avgtext+0avgdata 
> 0maxresident)k
>        0inputs+0outputs (0major+198minor)pagefaults 0swaps
>        ( it seems memory leak or undocumented features of the bash...)
>
>        BASH 2.05 said:
>        $ TIMEFORMAT=1 time echo q
>        -bash: time: command not found
>
This is not a bug:

time is special, it's not a builtin, it's not a command it's a keyword
like "while".

The manual says that you can set the environment temporarly for a simple command
when you do :

   TIMEFORMAT='test'  time echo foo

Bash thinks that you want to call the external command time  because

  '/usr/bin/time echo foo'

invokes the simple command 'time' while:

'time foo echo'  (with the keyword time)

is a pipeline

hope this helps.




reply via email to

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