Sh: time command not found

bashllvmshtime

In llvm 3.0 test-suite, the snippet of code bellow gives the following error on bash:

sh: time command not found

if [ "x$RHOST" = x ] ; then
  ( sh -c "$ULIMITCMD $TIMEIT -p sh -c '$COMMAND >$OUTFILE 2>&1 < $INFILE; echo exit \$?'" ) 2>&1 \
| awk -- '\
BEGIN     { cpu = 0.0; }
/^user/   { cpu += $2; print; }
!/^user/  { print; }
END       { printf("program %f\n", cpu); }' > $OUTFILE.time

where $TIMEIT = time.

I tried to change "sh -c" to "eval" but the error continued.

While trying to solve this error, I noticed something funny that may or may not help solving this:
running sh -c "time" works but sh -c "time -p" doesn't.

Do any of you guys have any idea why this error happens and how would I solve it?

Thanks in advance

Best Answer

To answer this here: time is a reserved word in shells. To use the actual command, try command time [options] [command] or /usr/bin/time [options] [command].

Source: https://askubuntu.com/a/86196