How do I accomplish this command to redirect command output to multiple files, without retyping the later A=1>&/dev/tty 1>&${TMP}/lastcmdout every time?
I want to see output on the current TTY and redirect to files. The following accomplishes what I want, but I don't want to retype the ending.
$ cmd0 | cmd1 1>&/dev/tty 1>&${TMP}/lastcmdout
I tried making a script shttf:
${SHELL} -c ${1} 1>&/dev/tty 1>&${TMP}/lastcmdout
and invoking
$ shttf 'cmd1 | cmd2'
so I can see the output and also redirect it a file, however this isn't working.
I'm considering these shells: ksh88, ksh93, zsh.
kshand little aboutzshso this is just an idea that may work (with a different syntax) in one of these shells. Inbashyou can permanently change file descriptors withexec 1>&/dev/ttyteecommand that seems to do what you want;cmd | tee /tmp/outputwill send the output ofcmdto the screen and to the file.