Trying to figure out how to use previous command exit code as argument in a command segment. #6649
Unanswered
CanvasofSpores
asked this question in
Troubleshoot
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
Hey, so I have a command that I want to run in my prompt that uses my previously run command's exit code as an argument. I'm pretty sure that using $? is only giving me code 0 due to it being overwritten somewhere between me running my command, and everything in my prompt being generated and written to prompt.
For now, I'm just using
echo $?as my command in substitute for the actual command I want to use because that's an easy way for me to see if the exit code is correct, and it seems to always be giving code 0 (success), even when my commands fail and show the proper code by the status segmentAt this point, I'm not sure how I'd be able to either capture the command exit code, or if I could use the code given by the status segment somehow?
Beta Was this translation helpful? Give feedback.
All reactions