Re: Odd bash behaviour with time:

2014-11-05 Thread Piotr Grzybowski
On Tue, Nov 4, 2014 at 1:24 AM, Ángel González wrote: > > There are more syntax errors equivalent to the "time;" case: [..] I completely agree with Linda :) > time | foo this one can be got rid of by the following (it will make time | time | time | time; possible, very much like having spam-w

Re: Odd bash behaviour with time:

2014-11-04 Thread Piotr Grzybowski
On Tue, Nov 4, 2014 at 9:03 AM, Andreas Schwab wrote: > ksh fails the same as bash: > > ksh: syntax error at line 1: `|' unexpected oh, we have to be better than ksh ;-) pg

Re: Odd bash behaviour with time:

2014-11-04 Thread Piotr Grzybowski
On Tue, Nov 4, 2014 at 1:24 AM, Ángel González wrote: > Piotr Grzybowski wrote: >> Hi Chet, hi all. >>[..] > There are more syntax errors equivalent to the "time;" case: > time & > time && bar > time | foo > time || true thanks for pointing that out. Some of these require more attention I think.

Re: Odd bash behaviour with time:

2014-11-04 Thread Andreas Schwab
Ángel González writes: > time | foo ksh fails the same as bash: ksh: syntax error at line 1: `|' unexpected Andreas. -- Andreas Schwab, SUSE Labs, sch...@suse.de GPG Key fingerprint = 0196 BAD8 1CE9 1970 F4BE 1748 E4D4 88E3 0EEA B9D7 "And now for something completely different."

Re: Odd bash behaviour with time:

2014-11-03 Thread Ángel González
Piotr Grzybowski wrote: > Hi Chet, hi all. > > based on what you say, and some comments in parse.y ;-) isn't the > below patch enough to get rid of the parser error for "time;echo;" > case? > > diff --git a/parse.y b/parse.y > index 815db98..766f258 100644 > --- a/parse.y > +++ b/parse.y > @@ -1

Re: Odd bash behaviour with time:

2014-11-01 Thread Chet Ramey
On 11/1/14 2:10 PM, Piotr Grzybowski wrote: > Hi Chet, hi all. > > based on what you say, and some comments in parse.y ;-) isn't the > below patch enough to get rid of the parser error for "time;echo;" > case? Yes, it's probably the right thing to do for maximum compatibility with the external `

Re: Odd bash behaviour with time:

2014-11-01 Thread Linda Walsh
Piotr Grzybowski wrote: This is not meaningful: # time ;echo hello bash: syntax error near unexpected token `echo' Ahh...and this IS meaningful: (?) # time ; ; echo hello 0.00sec 0.00usr 0.00sys (0.00% cpu) hello How about this? # time ; ; sleep 1 or this? # time ; ; time sleep 1 0.00sec

Re: Odd bash behaviour with time:

2014-11-01 Thread Piotr Grzybowski
Hi Chet, hi all. based on what you say, and some comments in parse.y ;-) isn't the below patch enough to get rid of the parser error for "time;echo;" case? diff --git a/parse.y b/parse.y index 815db98..766f258 100644 --- a/parse.y +++ b/parse.y @@ -1224,6 +1224,8 @@ pipeline_command: pipeline

Re: Odd bash behaviour with time:

2014-11-01 Thread Chet Ramey
On 10/31/14 2:01 PM, b...@m8y.org wrote: > $ time; > > real0m0.000s > user0m0.000s > sys 0m0.000s > $ time;ls > bash: syntax error near unexpected token `ls' > $ /usr/bin/time;/bin/ls Usage: /usr/bin/time [-apvV] [-f format] [-o file] > [--append] [--verbose] >[--portability] [

Re: Odd bash behaviour with time:

2014-11-01 Thread Piotr Grzybowski
Hello, Dear Eduardo. I am really sorry that you felt offended. I sent you a private mail in order keep the list clean, and to show that there are no hard feelings, sorry if you felt offended by that as well. Just in passing my Spanish is not broken, and sorry if you felt offended by that too. Pl

Re: Odd bash behaviour with time:

2014-10-31 Thread jon
>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 " is broken - I suspect the two issues are not related. > According to my tests, it also fails like OP reported in posix mode: The

Re: Odd bash behaviour with time:

2014-10-31 Thread Ryan Cunningham
Sorry---I misunderstood. Sent from my iPod On Oct 31, 2014, at 6:40 PM, Ryan Cunningham wrote: > On Oct 31, 2014, at 6:12 PM, jon wrote: > >> Maybe it should be more like this: >> >> # time >> Error, 'time' with no arguments is only meaningful in posix mode > Or maybe like this (to be more l

Re: Odd bash behaviour with time:

2014-10-31 Thread Eduardo A . Bustamante López
> Two comments. > > 1) The shell is not in posix mode. Yep. According to my tests, it also fails like OP reported in posix mode: | dualbus@dualbus ~ % bash -c $'for ((i=0;i<1;i++)); do :; done\ntime' | | real0m0.000s | user0m0.000s | sys 0m0.000s | dualbus@dualbus ~ % bash --pos

Re: Odd bash behaviour with time:

2014-10-31 Thread Ryan Cunningham
On Oct 31, 2014, at 6:12 PM, jon wrote: > Maybe it should be more like this: > > # time > Error, 'time' with no arguments is only meaningful in posix mode Or maybe like this (to be more like the standard BASH error format): bash: time: an argument is required (POSIX mode enabled) Sent from my

Re: Odd bash behaviour with time:

2014-10-31 Thread jon
> | When the shell is in posix mode, time may be followed by a newline. In > this case, the shell displays the > | total user and system time consumed by the shell and its children. The > TIMEFORMAT variable may be used > | to specify the format of the time information. > Two comments. 1)

Re: Odd bash behaviour with time:

2014-10-31 Thread Eduardo A . Bustamante López
To Piotr: On Sat, Nov 01, 2014 at 12:35:47AM +0100, Piotr Grzybowski wrote: > well, thats what I have been trying to say, before Eduardo almost killed me > :) > help time clearly states that is requires a pipeline, NULL pipeline > is something that does not exist. it is just a bad usage of time

Re: Odd bash behaviour with time:

2014-10-31 Thread Piotr Grzybowski
Hi Jon, dedicated to you, (a bit trickier to find, since time is a static shell builtin): diff --git a/execute_cmd.c b/execute_cmd.c index 9cebaef..47c6890 100644 --- a/execute_cmd.c +++ b/execute_cmd.c @@ -693,6 +693,10 @@ execute_command_internal (command, asynchronous, pipe_in, p }

Re: Odd bash behaviour with time:

2014-10-31 Thread Piotr Grzybowski
Hi Jon, well, thats what I have been trying to say, before Eduardo almost killed me :) help time clearly states that is requires a pipeline, NULL pipeline is something that does not exist. it is just a bad usage of time built-in. cheers, pg On Sat, Nov 1, 2014 at 12:31 AM, jon wrote: > On Fr

Re: Odd bash behaviour with time:

2014-10-31 Thread jon
On Fri, 2014-10-31 at 15:56 -0700, Eduardo A. Bustamante López wrote: > > well, help time clearly states how it should be used. > You are clearly not understanding the point. > > The point is: why does > > time > > work, but > > time ; somecommand > > doesn't. > > It's that simple. It's

Re: Odd bash behaviour with time:

2014-10-31 Thread Eduardo A . Bustamante López
> well, help time clearly states how it should be used. You are clearly not understanding the point. The point is: why does time work, but time ; somecommand doesn't. It's that simple. It's not a usage question, I'm very aware of how to use time. Stop being condescending.

Re: Odd bash behaviour with time:

2014-10-31 Thread Piotr Grzybowski
On Fri, Oct 31, 2014 at 11:21 PM, Eduardo A. Bustamante López wrote: > Hm, read again. It is stated that the external command doesn't have > that issue. This is precisely related to the time builtin and why it > would cause a syntax error in this case. Ola, ?que tal? well, help time clearly sta

Re: Odd bash behaviour with time:

2014-10-31 Thread Eduardo A . Bustamante López
On Fri, Oct 31, 2014 at 11:00:22PM +0100, Piotr Grzybowski wrote: > Hi, > > it is actually built-in time that you run: Hm, read again. It is stated that the external command doesn't have that issue. This is precisely related to the time builtin and why it would cause a syntax error in this case.

Re: Odd bash behaviour with time:

2014-10-31 Thread Piotr Grzybowski
Hi, it is actually built-in time that you run: help time if you want to run time from /usr/bin: /usr/bin/time cheers, pg On Fri, Oct 31, 2014 at 7:01 PM, wrote: > $ time; > > real0m0.000s > user0m0.000s > sys 0m0.000s > $ time;ls > bash: syntax error near unexpected token `ls'