From 9aa74c53f1172d1ed116575e9e4224b608252cb8 Mon Sep 17 00:00:00 2001 From: Pratham Patel Date: Tue, 19 Mar 2024 16:59:27 +0530 Subject: [PATCH] bashrc: move call for $nixos_needsreboot into `PS0` to prevent setting `$?` to `0` --- .bashrc | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/.bashrc b/.bashrc index ee80114..d0049f2 100644 --- a/.bashrc +++ b/.bashrc @@ -219,8 +219,11 @@ function nixos_needsreboot() { } # PS1 setup -PS0="\t\n" # display time in HH:MM:SS format -PS1='$(nixos_needsreboot)'"\n[\u@\h:\$PWD \$?]\$ " +PS0="\t" # display time in HH:MM:SS format +# the function needs to be called **everytime** and is in single quotes +# shellcheck disable=SC2016 +PS0+='$(nixos_needsreboot)'"\n" +PS1="\n[\u@\h:\$PWD \$?]\$ " export PS0 PS1 # zoxide setup