scenario: the shell script completes the ETL work. The data extraction, transformation and loading operations correspond to three subscripts, all of which are atomic operations and need to be logged.
idea: call multiple child scripts to control the workflow through a single parent script, and get the exit status and output of the subscript at the same time.
problem: the following script cannot get the exit status of the subscript. You need to have standard output and error output on the screen and log it at the same time.
-sharp!/bin/bash
-sharpparent.sh
echo "You are in parent shell." | tee $0".log"
./child.sh; rc=$? | tee -a $0".log"
echo $rc
-sharp!/bin/bash
-sharpchild.sh
echo "You are in child shell."
exit 1