What are the numbers preceding root@archiso `# ?
Often, running a command makes my zsh go from
root@archiso ` #
to
2 root@archiso ` #
or
127 root@archiso ` #
or a few other numbers instead of 2 and 127.
What does that mean?
I've been trying to find out for a couple days now, but turns out my google-fu just isn't strong enough. So, before dying to my curiosity, I ask here
About this post
- Posted
- Archived
- Score
- 17 · 100% up
- Kind
- Text
- ID
- bl55hd
10 comments
Those are exit codes.
According to tldp:
Thanks a ton dude
No problem.
I believe it is the return code of the last command executed (?) echo $PS1 to see how the prompt is built up
To add on some further explanation to what other people have said, when you run a command, it returns with an exit status. An exit status of 0 indicates success, and anything other than 0 indicates failure. The number before the rest of your prompt is the exit status of the command you just executed.
Generally. Not a rule, but the standard practice
(though offhand I can't remember anything that doesn't follow the rule, that isn't a program specific to counting things)
(you ain't wrong, just clarifying for the youngin's in the crowd)
I love pseudo-binary fails in legacy code.
Did it work return yes/no instead of true/false.
But yes is 0 and 1 is no.
Deleted before we saved it.
Exit codes