Bug 38985

Summary: time doesn't recognize its command-line options
Product: Documentation Reporter: Chris Pepper <pepper>
Component: Books & ArticlesAssignee: Giorgos Keramidas <keramida>
Status: Closed FIXED    
Severity: Affects Only Me    
Priority: Normal    
Version: Latest   
Hardware: Any   
OS: Any   

Description Chris Pepper 2002-06-07 16:20:02 UTC
time's man page says it provides various flags, including -h (human-readable) and -p (POSIX-style), but these flags generate errors when used.

guest# man time
TIME(1)                 FreeBSD General Commands Manual                TIME(1)

NAME
     time - time command execution

SYNOPSIS
     time [-al] [-h | -p] [-o file] command

DESCRIPTION
     The time utility executes and times command by initiating a timer and
     passing the command to the shell.  After the command finishes, time
     writes to the standard error stream, (in seconds): the total time
     elapsed, the time used to execute the command process and the time con-
     sumed by system overhead.

     Available options:

     -a      If the -o flag is used, append to the specified file rather than
             overwriting it.  Otherwise, this option has no effect.

     -h      Print times in a human friendly format.  Times are printed in
             minutes, hours, etc. as appropiate.

     -l      The contents of the rusage structure are printed as well.

     -o file

How-To-Repeat: guest# time -h ls
-h: Command not found.
0.000u 0.000s 0:00.00 0.0%      0+0k 0+0io 0pf+0w
guest# time -p ls
-p: Command not found.
0.000u 0.000s 0:00.00 0.0%      0+0k 0+0io 0pf+0w
guest# time -l ls
-l: Command not found.
0.000u 0.000s 0:00.00 0.0%      0+0k 0+0io 0pf+0w
Comment 1 darklogik 2002-06-07 21:59:21 UTC
Chris Pepper wrote:

>>Number:         38985
>>Category:       docs
>>Synopsis:       time doesn't recognize its command-line options
>>Confidential:   no
>>Severity:       non-critical
>>Priority:       medium
>>Responsible:    freebsd-doc
>>State:          open
>>Quarter:        
>>Keywords:       
>>Date-Required:
>>Class:          doc-bug
>>Submitter-Id:   current-users
>>Arrival-Date:   Fri Jun 07 08:20:02 PDT 2002
>>Closed-Date:
>>Last-Modified:
>>Originator:     Chris Pepper
>>Release:        4.6RC
>>Organization:
>>Environment:
>>
> FreeBSD guest.reppep.com 4.6-RC FreeBSD 4.6-RC #0: Fri May 31 22:33:23 EDT 2002     root@guest.reppep.com:/usr/obj/usr/src/sys/GENERIC  i386
> 
> 
>>Description:
>>
> time's man page says it provides various flags, including -h (human-readable) and -p (POSIX-style), but these flags generate errors when used.
> 
> guest# man time
> TIME(1)                 FreeBSD General Commands Manual                TIME(1)
> 
> NAME
>      time - time command execution
> 
> SYNOPSIS
>      time [-al] [-h | -p] [-o file] command
> 
> DESCRIPTION
>      The time utility executes and times command by initiating a timer and
>      passing the command to the shell.  After the command finishes, time
>      writes to the standard error stream, (in seconds): the total time
>      elapsed, the time used to execute the command process and the time con-
>      sumed by system overhead.
> 
>      Available options:
> 
>      -a      If the -o flag is used, append to the specified file rather than
>              overwriting it.  Otherwise, this option has no effect.
> 
>      -h      Print times in a human friendly format.  Times are printed in
>              minutes, hours, etc. as appropiate.
> 
>      -l      The contents of the rusage structure are printed as well.
> 
>      -o file
> 
> 
>>How-To-Repeat:
>>
> guest# time -h ls
> -h: Command not found.
> 0.000u 0.000s 0:00.00 0.0%      0+0k 0+0io 0pf+0w
> guest# time -p ls
> -p: Command not found.
> 0.000u 0.000s 0:00.00 0.0%      0+0k 0+0io 0pf+0w
> guest# time -l ls
> -l: Command not found.
> 0.000u 0.000s 0:00.00 0.0%      0+0k 0+0io 0pf+0w
> 
> 


echo $SHELL
man 1 builtin



-- 
Tom (Darklogik) Rhodes
www.Pittgoth.com Gothic Discussion Forum
www.FreeBSD.org  The Power To Serve
trhodes@{Pittgoth.com, FreeBSD.org}
Comment 2 Giorgos Keramidas freebsd_committer freebsd_triage 2002-06-08 01:13:07 UTC
On 2002-06-07 09:16 -0700, Ross Lippert wrote:
>
> >Sounds like you're using the shell built-in version of time...
> >try doing
> >        which time
> >to see which one you're using.  /usr/bin/time supports the flags
> >you mentioned!
>
> HAHA!! not so fast there buddy.
>
> bash-2.05a$ which time
> /usr/bin/time
> bash-2.05a$ time date
> Fri Jun  7 12:11:08 EDT 2002
>
> real    0m0.003s
> user    0m0.000s
> sys     0m0.001s
> bash-2.05a$ /usr/bin/time date
> Fri Jun  7 12:11:12 EDT 2002
>         0.00 real         0.00 user         0.00 sys

The bash shell doesn't have a "which" builtin.  Try "type":

	03:10:55 [charon@labs ~]$ type which
	which is /usr/bin/which

	03:10:57 [charon@labs ~]$ echo $SHELL
	/bin/bash

	03:11:00 [charon@labs ~]$ which time
	/usr/bin/time

	03:11:03 [charon@labs ~]$ type time
	time is a shell keyword

- Giorgos
Comment 3 Giorgos Keramidas freebsd_committer freebsd_triage 2002-06-08 01:14:15 UTC
State Changed
From-To: open->closed

There's nothing really wrong with time(1).  It describes /usr/bin/time 
which is different from Bourne shell's `time' builtin.  Nevertheless, 
thankie for trying to help with making FreeBSD a better OS than it 
already is for all of us ;) 


Comment 4 Giorgos Keramidas freebsd_committer freebsd_triage 2002-06-08 01:14:15 UTC
Responsible Changed
From-To: freebsd-doc->keramida