I am redirecting the output of a script to a function I've written by using 2>&1 | MyFunction
This works great. However, I'm having a difficult time figuring out how to determine if the variable being passed is STDOUT
or STDERR
in MyFunction
Ex:
function MyFunction {
while read line; do
read IN
echo "LOG: $IN" >> $LOG_FILE;
done
}
Is there some way the perform a check on the passed variable if it is an instance of either STDOUT
or STDERR
so I can perform conditional rules based upon it?