How to output return code in shell?

前端 未结 3 851
孤街浪徒
孤街浪徒 2021-02-05 02:50

I\'m trying to call a custom shell script through sh:

/bin/sh -c \'myscript.sh` >log.txt 2>&1 & echo $!

Output of th

3条回答
  •  既然无缘
    2021-02-05 03:06

    echo $? >> /path/to/return_code
    

    $? has the return code of the last statement in bash.

提交回复
热议问题