Scenario:
$ cat libs.txt
lib.a
lib1.a
$ cat t1a.sh
f1()
{
local lib=$1
stdbuf -o0 printf "job for $lib started\n"
sleep 2
stdbuf -o0 printf "job for $lib done\n"
}
export -f f1
/usr/bin/time -f "elapsed time %e" cat libs.txt | SHELL=$(type -p bash) parallel --line-buffer --jobs 2 f1
$ bash t1a.sh
elapsed time 0.00
job for lib.a started
job for lib1.a started
job for lib.a done
job for lib1.a done
Here we see that elapsed time 0.00 appears before command's output. Why?
How to make elapsed time 0.00 appear after command's output?
/usr/bin/timedoesn't (and can't) time a pipeline like the bash shell keywordtimecan. You'll have to wrap the whole pipeline insh -c./usr/bin/timemeasurescat libs.txtonly and thecatis fast here.