diff options
author | June McEnroe <june@causal.agency> | 2019-11-20 21:46:01 -0500 |
---|---|---|
committer | June McEnroe <june@causal.agency> | 2019-11-20 21:46:01 -0500 |
commit | 0171ff50e7e8ce7a8a924868cba58a296664a915 (patch) | |
tree | dbf5ef32475f281013000204785d10eb52308161 /bin/1sh/parser.c | |
parent | Remove PSlit (diff) | |
download | src-0171ff50e7e8ce7a8a924868cba58a296664a915.tar.gz src-0171ff50e7e8ce7a8a924868cba58a296664a915.zip |
Add \? exit status prompt expansion
Diffstat (limited to '')
-rw-r--r-- | bin/1sh/parser.c | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/bin/1sh/parser.c b/bin/1sh/parser.c index 377ab78f..39b36e67 100644 --- a/bin/1sh/parser.c +++ b/bin/1sh/parser.c @@ -2039,6 +2039,16 @@ expandprompt(const char *fmt) { break; /* + * Exit status if non-zero. + */ + case '?': + if (exitstatus != 0) + snprintf(&ps[i], PROMPTLEN - i, "%d", exitstatus); + else + i--; + break; + + /* * Superuser status. * * '$' for normal users, '#' for root. |