From 4d8cf6514e6232b6a8dd3a72e59e230d81c5eaf0 Mon Sep 17 00:00:00 2001 From: Jonas 'Sortie' Termansen Date: Mon, 13 Feb 2023 00:01:07 +0100 Subject: [PATCH] Color the default root shell prompt red and gold. --- sh/sh.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/sh/sh.c b/sh/sh.c index 9ea8834b..2b382245 100644 --- a/sh/sh.c +++ b/sh/sh.c @@ -2024,7 +2024,9 @@ void read_command_interactive(struct sh_read_command* sh_read_command) edit_state.complete_context = NULL; edit_state.complete = do_complete; - const char* def_ps1 = "\\033[;1;32m\\u@\\H \\033[1;34m\\w \\$\\033[m "; + const char* def_ps1 = !getuid() ? + "\\033[;1;31m\\u\033[1;33m@\\H \\033[1;34m\\w \\033[1;31m\\$\\033[m " : + "\\033[;1;32m\\u@\\H \\033[1;34m\\w \\$\\033[m "; const char* def_ps2 = "> "; edit_state.ps1 = eval_ps(getenv_safe_def("PS1", def_ps1)); edit_state.ps2 = eval_ps(getenv_safe_def("PS2", def_ps2));