Got a little bash script like so:
#!/bin/bash
TIME_CMD='/usr/bin/time -f "%E execution time"'
${TIME_CMD} ls
Only problem: doesn't work:
/usr/bin/time: cannot run execution: No such file or directory
Command exited with non-zero status 127
"0:00.00
What am I doing wrong?
Try making it...
#!/bin/bash
TIME_CMD='/usr/bin/time -f "%E execution time"'
eval "$TIME_CMD ls"
This will utilize bash to re-parse the command string after it has been constructed, so that the quoted argument will be recognized properly.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With