From: Plom Heller Date: Sat, 19 Sep 2026 03:06:00 +0000 (+0200) Subject: Add shell prompt formatting. X-Git-Url: https://plomlompom.com/repos/booking?a=commitdiff_plain;h=a7d1fb525fa8d991ab072cdf59a83672983bdc39;p=confplom Add shell prompt formatting. --- diff --git a/home/user/.profile.prompt b/home/user/.profile.prompt new file mode 100644 index 0000000..c543779 --- /dev/null +++ b/home/user/.profile.prompt @@ -0,0 +1,20 @@ +_dot_profile_dot_prompt() { + local COLOR_NUMBER=2 + local COLOR_ON + local COLOR_OFF + COLOR_ON="$(tput setaf "${COLOR_NUMBER}" 2>/dev/null)$(tput bold 2>/dev/null)" + COLOR_OFF="$(tput sgr0 2>/dev/null)" + # Bash confuses the line length when not told not to count escape + # sequences. PS3 is printed verbatim by "select", so it must get the + # unwrapped codes. + PS3="${COLOR_ON}select: ${COLOR_OFF}" + if [ -n "${BASH:-}" ]; then + COLOR_ON="\[${COLOR_ON}\]" + COLOR_OFF="\[${COLOR_OFF}\]" + fi + PS1="${COLOR_ON}[\D{%Y-%m-%d/%H:%M:%S/%Z} \u@\h:\w]\$ ${COLOR_OFF}" + PS2="${COLOR_ON}> ${COLOR_OFF}" + PS4="${COLOR_ON}+ ${COLOR_OFF}" +} +_dot_profile_dot_prompt +unset -f _dot_profile_dot_prompt