Hi, I have written scritp which prints output from the executable to standard output as well as in a file. Here "add" is an c executable which returns
some value based on inputs.
But if tee is not used "$?" returns the return value from add exe.
If tee is used it is simply retuning 0.
echo "Running program output"
myLine="./add 1 11"
`expr "$myLine"`| tee outputfile
echo "Succ/Fail : $?"
Want to print output from the exe to file and terminal at a time.
So, used `tee` command. But return status of tee is printed instead of
exe return value.
Can use pipestatus. pipestatus is printing value but need to run like "bash script.sh". I need to run the script using "sh".
Help needed.