Bash reserved words vs. built-in commands, and formatting the output of the time command
Solution 1:
Most reserved words are commands that are built into bash; if you want to use an executable that has the same name as a reserved word then either specify the full path to the executable, or escape the command with a backslash.
$ time
real 0m0.000s
user 0m0.000s
sys 0m0.000s
$ \time
Usage: time [-apvV] [-f format] [-o file] [--append] [--verbose]
[--portability] [--format=format] [--output=file] [--version]
[--help] command [arg...]
$ then
bash: syntax error near unexpected token `then'
$ \then
bash: then: command not found
Also, BASH FAQ #32: "How can I redirect the output of 'time' to a variable or file?".
Solution 2:
You can use builtin <cmd>
and command <cmd>
to force calling a bash built-in or an external command.