简体   繁体   中英

How to get the individual exit codes of all the shell scripts invoked by a parent shell script?

I am new to shell scripting and I am trying to invoke several shell scripts from a single parent shell script. Is there a way for me to get the exit codes of all the individual shell scripts(trying to know if they were successful or there was an error and may be save the exit codes to a file, if that's possible) after all the scripts have completed execution?

Any help would be appreciated. Thank you.

After each script finishes you can check the $? variable for its status. But, this only reports the exit status of the last command run, so you need to check it after each script and then (perhaps) set other varaibles to reference when the entire series is finished.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM