I would like to create a pipe in a ksh script (using exec) that pipe\'s to a tee, and sends the output to a pipe.
Current:
#Redirect EVE
I worked out a solution using named pipes.
#!/bin/ksh
LOG=~/testLog.log
PIPE=~/logPipe
mkfifo ${PIPE}
exec 3>&1 #Save STDOUT as 3
exec 4>&2 #Save STDERR as 4
tee -a ${LOG} <${PIPE} >&3 & #Start tee off the logpipe in the background
exec 1>${PIPE} #Redirect stdout to the pipe
exec 2>&1 #Redirect STDERR to STDOUT
echo "TEST"
echo Test 2
ls | grep -i "test"
rm -f ${PIPE} #Remove the pipe