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