I have a simple task to do from within a shell script - redirect command output to a variable as well as stdout. I already went through redirect command output into variable and standard output in ksh, and came up with:
VAR1=$(ps -u "${USER}" | awk 'NR>1 {print $NF}' | tee > /proc/$$/fd/1)
However the above doesn't work for me. The output displays on STDOUT
fine, but its not saved in VAR1
. What am I missing here ?