I want change i/o of the time command, lake the following commands, but they are wrong and do not work. How to do this correctly?
time echo hello > log
bash -c 'time echo hello' > log
echo $(time echo hello) > log
I want change i/o of the time command, lake the following commands, but they are wrong and do not work. How to do this correctly?
time echo hello > log
bash -c 'time echo hello' > log
echo $(time echo hello) > log
man test
.test
does not read STDIN, does not write STDOUT or STDERR, it just sets$?
($STATUS
). What do you want to change? – waltinator Jun 10 '23 at 14:26help test
is likely more pertinent thanman test
. AFAIK both the bash shell builtintest
and external/usr/bin/test
do write to the standard error stream (and will do so in this case ex.test: echo: unary operator expected
or/usr/bin/test: missing argument after ‘hello’
). – steeldriver Jun 10 '23 at 14:35>
operator only redirects the standard output stream - if you want to redirect standard error to a file, see this similar question Command output is not redirected to file – steeldriver Jun 10 '23 at 14:37