Each command run in the command line is, in order:
- interpreted by the shell;
- interpreted by the executable;
In this case |
makes the shell interpret sudo gnome-terminal -x sudo fio myjog | tee mylog
as two commands piped to each other (sudo gnome-terminal -x sudo fio myjog
and tee mylog
, the first one piped to the second one).
The result of this is that the output of sudo gnome-terminal -x sudo fio myjog
is piped to tee mylog
; since gnome-terminal
doesn't output anything, mylog
is empty.
Use the -e
option to pass the command to be executed as an argument;
Commands passed through the -e
options are executed in sh
;
In this case, since you want to use a pipe, which is a bash
(and other shells) feature, you'll need to explicitly run the command in bash
(on a side note: you don't need sudo
to run gnome-terminal
if you're going to use sudo
in the argument to the -x
/ -e
options):
gnome-terminal -e "bash -c \"sudo fio myjog | tee mylog\""