FAQ Search Today's Posts Mark Forums Read
» Video Reviews

» Linux Archive

Linux-archive is a website aiming to archive linux email lists and to make them easily accessible for linux users/developers.


» Sponsor

» Partners

» Sponsor

Go Back   Linux Archive > Debian > Debian User

 
 
LinkBack Thread Tools
 
Old 04-05-2011, 07:02 PM
"Boyd Stephen Smith Jr."
 
Default Problem with time command

On 2011-04-05 11:40:51 Fabio Dellacorte wrote:
>i want use option for time command but it doesn't work because intepreted
>anything as argument :
>
>$time --version
>bash: --version: command not found

bss@dellbuntu:~$ time --version
bash: --version: command not found

real 0m0.001s
user 0m0.000s
sys 0m0.000s
bss@dellbuntu:~$ command time --version
GNU time 1.7
bss@dellbuntu:~$ type time
time is a shell keyword

(Bash has a time "builtin" that you should avoid if you want to use the time
binary.)
--
Boyd Stephen Smith Jr. ,= ,-_-. =.
bss@iguanasuicide.net ((_/)o o(\_))
ICQ: 514984 YM/AIM: DaTwinkDaddy `-'(. .)`-'
http://iguanasuicide.net/ \_/
 
Old 04-06-2011, 09:36 AM
Chris Jackson
 
Default Problem with time command

Boyd Stephen Smith Jr. wrote:

> GNU time 1.7
> bss@dellbuntu:~$ type time
> time is a shell keyword
>
> (Bash has a time "builtin" that you should avoid if you want to use the time
> binary.)


Actually it's a keyword not a builtin. By contrast, "kill":

chrisj@alice$ type kill
kill is a shell builtin

This also means you can't disable it:

chrisj@alice$ enable -n time
bash: enable: time: not a shell builtin

Not sure why time is a keyword (on a par with if, for etc.) rather than
a builtin, but there you go. If anyone has any enlightenment, I'd be
curious

--
Chris Jackson
Shadowcat Systems Ltd.


--
To UNSUBSCRIBE, email to debian-user-REQUEST@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listmaster@lists.debian.org
Archive: 4D9C342A.1090008@shadowcat.co.uk">http://lists.debian.org/4D9C342A.1090008@shadowcat.co.uk
 
Old 04-06-2011, 01:16 PM
"Boyd Stephen Smith Jr."
 
Default Problem with time command

In <4D9C342A.1090008@shadowcat.co.uk>, Chris Jackson wrote:
>Boyd Stephen Smith Jr. wrote:
>> GNU time 1.7
>> bss@dellbuntu:~$ type time
>> time is a shell keyword
>>
>> (Bash has a time "builtin" that you should avoid if you want to use the
>> time binary.)
>
>Actually it's a keyword not a builtin.

That's why I used quotes. For most purposes it can be treated like a shell
builtin, but it's not really one.

Shell keywords are part of it's parser syntax, and may or may not be
valid/recognized everywhere a command. Shell builtins are not part of the
parser syntax, but are simply "found" before any binary in the PATH. Shell
special builtins modify properties of the shell process, so they can't be
simply executed by fork/exec and are allowed to exit the shell in certain
failure cases.

In this particular case, "time" isn't recognized as a keyword except as the
first part of a pipeline. When it is not recognized as a keyword, the time
binary is used:
bss@monster:~$ time echo | time --version
GNU time 1.7

real 0m0.002s
user 0m0.000s
sys 0m0.000s
bss@monster:~$ # or even ...
bss@monster:~$ time time --version
GNU time 1.7

real 0m0.002s
user 0m0.000s
sys 0m0.000s

--
Boyd Stephen Smith Jr. ,= ,-_-. =.
bss@iguanasuicide.net ((_/)o o(\_))
ICQ: 514984 YM/AIM: DaTwinkDaddy `-'(. .)`-'
http://iguanasuicide.net/ \_/
 
Old 04-07-2011, 03:54 AM
Teemu Likonen
 
Default Problem with time command

* 2011-04-05T14:02:34-05:00 * Boyd Stephen Smith, Jr. wrote:

> bss@dellbuntu:~$ type time
> time is a shell keyword

There is also this useful option "-a":

$ type -a time
time is a shell keyword
time is /usr/bin/time


--
To UNSUBSCRIBE, email to debian-user-REQUEST@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listmaster@lists.debian.org
Archive: 87vcyqpvh1.fsf@mithlond.arda">http://lists.debian.org/87vcyqpvh1.fsf@mithlond.arda
 
Old 04-12-2011, 05:13 AM
Scott Ferguson
 
Default Problem with time command

On 06/04/11 02:40, Fabio Dellacorte wrote:
> Hello everybody ,
> i want use option for time command but it doesn't work because
> �intepreted anything as argument :
>
>
> $time --version
> bash: --version: command not found
>
>
> Thank you
>


Time *requires* a command before any arguments - hence your error message
So "time --version" will not return the version information for the
"time" command, but:-
time mlocate --version
will return the version information for *mlocate* and tell you how long
it took to do that. eg:-

scott@work:~$ time mlocate --version
mlocate 0.21.1
Copyright (C) 2007 Red Hat, Inc. All rights reserved.
This software is distributed under the GPL v.2.

This program is provided with NO WARRANTY, to the extent permitted by law.

real 0m0.029s
user 0m0.000s
sys 0m0.000s

from the man file:-
"time run the program COMMAND with any given arguments"

Cheers

--
Tuttle? His name's Buttle.
There must be some mistake.
Mistake? [Chuckles]
We don't make mistakes.


--
To UNSUBSCRIBE, email to debian-user-REQUEST@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listmaster@lists.debian.org
Archive: 4DA3DF7F.7010000@gmail.com">http://lists.debian.org/4DA3DF7F.7010000@gmail.com
 
Old 04-12-2011, 12:40 PM
John Hasler
 
Default Problem with time command

Scott Ferguson writes:
> Time *requires* a command before any arguments

That's the builtin. Try "/usr/bin/time --version".
--
John Hasler


--
To UNSUBSCRIBE, email to debian-user-REQUEST@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listmaster@lists.debian.org
Archive: 87pqortzh6.fsf@thumper.dhh.gt.org">http://lists.debian.org/87pqortzh6.fsf@thumper.dhh.gt.org
 
Old 04-12-2011, 11:05 PM
Scott Ferguson
 
Default Problem with time command

On 12/04/11 22:40, John Hasler wrote:
> Scott Ferguson writes:
>> Time *requires* a command before any arguments
>
> That's the builtin. Try "/usr/bin/time --version".

'Thanks John', but, please, read the original post:-
http://lists.debian.org/debian-user/2011/04/msg00446.html

Cheers

--
Tuttle? His name's Buttle.
There must be some mistake.
Mistake? [Chuckles]
We don't make mistakes.


--
To UNSUBSCRIBE, email to debian-user-REQUEST@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listmaster@lists.debian.org
Archive: 4DA4DAC9.5020002@gmail.com">http://lists.debian.org/4DA4DAC9.5020002@gmail.com
 

Thread Tools




All times are GMT. The time now is 10:09 PM.

VBulletin, Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO ©2007, Crawlability, Inc.
Copyright ©2007 - 2008, www.linux-archive.org