Anyway to get return value of c program from command line?

前端 未结 2 1212
小鲜肉
小鲜肉 2020-12-28 12:47

I understand if I write a bash script I can get the return value, but is there anyway to get the return value without scripting, and just command line?

2条回答
  •  忘掉有多难
    2020-12-28 13:43

    In light of the invalidation of the previous answer (good point, Carl Norum), let me re-phrase my comment as an answer:

    BASH stores the return value of the previously run command in the variable $?. This is independent of the programming langauge used to write said command (the command can also be a shell internal).

提交回复
热议问题