From fa44f94313d04afe440f58e233347b8fa4c78605 Mon Sep 17 00:00:00 2001 From: June McEnroe Date: Wed, 20 Nov 2019 21:46:01 -0500 Subject: Add \? exit status prompt expansion --- bin/1sh/parser.c | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'bin/1sh/parser.c') 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 @@ -2038,6 +2038,16 @@ expandprompt(const char *fmt) { --i; break; + /* + * Exit status if non-zero. + */ + case '?': + if (exitstatus != 0) + snprintf(&ps[i], PROMPTLEN - i, "%d", exitstatus); + else + i--; + break; + /* * Superuser status. * -- cgit 1.4.1 /option> dontfiles
summary refs log tree commit diff
path: root/bin (unfollow)
Commit message (Expand)Author
2020-09-11Rewrite install script yet againJune McEnroe
2020-09-11Remove NetBSD from install scriptJune McEnroe
2020-09-11Use MacPorts rather than pkgsrcJune McEnroe
2020-09-11Add debian VM name to sshJune McEnroe
2020-09-11Add influencer tweetJune McEnroe
2020-09-10Add The Kingdom of GodsJune McEnroe
2020-09-07Add SunglassesJune McEnroe
2020-09-06Add Between the BreathsJune McEnroe
2020-09-04Open /dev/tty in nudgeJune McEnroe
2020-09-04Add nudgeJune McEnroe
2020-09-03Build fbclock with -lzJune McEnroe
2020-08-29Add tweets from retweetsJune McEnroe