How do I capture the return status and use tee at the same time in korn shell?

Consider Source code: 1. Parent.sh #!/usr/bin/ksh # No tee ksh Child.sh; exit_status=$?; echo "Exit status: ${exit_status}" # Using tee ksh Child.sh | tee -a log.txt; exit_status=$?; echo "Exit status: ${exit_status}" 2. Child.sh #!/usr/bin/ksh … exit 1; Output: Exit status: 1 Exit status: 0 Variable $exit_status is capturing the exit status of Child.sh and so is … Read more