←back to thread

217 points tanelpoder | 1 comments | | HN request time: 0.257s | source
Show context
scudd ◴[] No.26492906[source]
TIL: You can use `echo $?` to get the last process's exit code.
replies(2): >>26493051 #>>26493264 #
enriquto ◴[] No.26493051[source]
this is actually the most useful thing to put in your prompt (much more than your username, the current directory and other redundant stuff), as in PS1='$?\$ '
replies(2): >>26495670 #>>26497266 #
Noumenon72 ◴[] No.26497266[source]
Might be useful but I just spent half an hour trying everything at https://stackoverflow.com/questions/16715103/bash-prompt-wit... on a MacBook Pro and none of it worked.
replies(2): >>26497907 #>>26498559 #
1. LeoPanthera ◴[] No.26497907[source]
Maybe you are not using bash. echo $SHELL to find out.