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.testdoes 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 testis likely more pertinent thanman test. AFAIK both the bash shell builtintestand external/usr/bin/testdo write to the standard error stream (and will do so in this case ex.test: echo: unary operator expectedor/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