[Top][All Lists]

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

Re: Odd bash behaviour with time:

From: jon
Subject: Re: Odd bash behaviour with time:
Date: Sat, 01 Nov 2014 04:49:51 +0000

>But, the thing is... it shouldn't be a syntax error, right?
I agree, this thread is really about 2 issues.  The interpreter barf
with "time;" and the fact that "time <no args>" is broken - I suspect
the two issues are not related.

> According to my tests, it also fails like OP reported in posix mode:
The OP reported the syntax error, I reported that time noargs always
returns zero, IE it is broken.

> Or... why not have time behave the same in non-posix mode?...
> backwards compatibility is not an issue, since it's not useful right
> now. And the posix mode behavior is kind of useful.
I disagree, time with no arguments is a confusing idea.  

Time as a command is quite intuitive, but time with arguments is not -
most people would have to refer to the documentation to confirm what it
actually measures. 

As it it appears to measure nothing at all, and I believe a slightly
broken concept, then my personal preference would be to remove the "time
<noargs>" behaviour completely. All but the most marginal real world
cases can be tested like this:

# time /bin/bash -c 'somescript or command'

Even the loading setup time of bash itself can be tested like this:

# time /bin/bash -c 'exit'

It is better to have any real world script using time with no arguments
exit with an error in the future rather than report that everything is a
super computer as it does currently. 

reply via email to

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