Problem with time command

Polytropon freebsd at edvax.de
Fri Apr 21 16:41:12 UTC 2017


On Fri, 21 Apr 2017 12:30:48 -0400, Ernie Luzar wrote:
> Hello list;
> 
> Was testing the time command. These problems came to light.
> 
> 
> time [-al] [-h | -p ] utility-name

That somehow doesn't look like "man 1 time". The synopsis
should be:

SYNOPSIS
     time [-al] [-h | -p] [-o file] utility [argument ...]


> issuing time -h custom.refresh
> results in error message -h: Command not found
> 
> issuing time -p custom.refresh
> results in error message -p: Command not found

I assume you're running this command interactively from within the
C shell, right? In this case, use /usr/bin/time to use the actual
"time" binary. If you don't, the C shell's built-in time command
will be used.



> The DESCRIPTION says,
> The time utility executes and times the specified utility. After the 
> utility finishes, time writes to the standard error stream, (in 
> seconds): the total time elapsed, the time used to execute the utility 
> process and the time consumed by system overhead.
> 
> issuing time custom.refresh
> results in this output
> 0.089u 0.469s 0:01.44 37.5%     32+181k 64+137io 709pf+0w

That proves you're using the C shell's internal time command, not
the binary. It would have an output format like this:

% /usr/bin/time ls
        0.00s real              0.00s user              0.00s sys

When you use the "time" command _inside_ your script, the binary
will be used because sh (the script's interpreter) doesn't have
a built-in time command.



-- 
Polytropon
Magdeburg, Germany
Happy FreeBSD user since 4.0
Andra moi ennepe, Mousa, ...


More information about the freebsd-questions mailing list