4
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
Check
man time
and see if your implementation oftime
lacks the-p
flag. That said, even if the flag was the problem, the error should then be-p: command not found
nottime not found
. All that said, are you sure your system'ssh
is pointing tobash
? If you're on some operating systems, it may bedash
. (Again, not sure that helps unlessdash
lacks atime
built-in and you have no separatetime
command.) – Telemachus – 2012-04-29T14:26:38.540"
sh: time command not found
" - is that the exact error message? Also, what output doesreadlink -f "$(which sh)"
generate for you? – Daniel Andersson – 2012-04-29T17:18:43.423The "exact" error is: sh: time: command not found – Rafael – 2012-04-29T18:58:32.663
readlink -f "$(which sh)" outputs /bin/bash – Rafael – 2012-04-29T18:59:01.447
Check man time and see if your implementation of time lacks the -p flag. -> Using time -p works normally. The problem is when executed together with sh -c. eval "time - p" works though normally. But in the context of the script I'm executing it seems to not work (gives the error that the time command was not found) – Rafael – 2012-04-29T19:01:12.487