From 31a993b62a4ae3cc45874acf94754433f4dd1278 Mon Sep 17 00:00:00 2001 From: Alexander Hess Date: Thu, 6 Jun 2024 19:10:46 +0200 Subject: [PATCH] Clear screen only after confirmation --- .config/shell/logout.sh | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/.config/shell/logout.sh b/.config/shell/logout.sh index 7e58a45..85fc2ff 100644 --- a/.config/shell/logout.sh +++ b/.config/shell/logout.sh @@ -1,10 +1,18 @@ # This file is sourced by a login shell upon logout -# Clear the screen to increase privacy +# Clear the screen (if desired) to increase privacy if [ "$SHLVL" = 1 ]; then if [ -x /usr/bin/clear ]; then - /usr/bin/clear + read -p "Clear screen? " -n 1 -r + echo + if [[ $REPLY =~ ^[Yy]$ ]]; then + /usr/bin/clear + fi elif [ -x /usr/bin/clear_console ]; then - /usr/bin/clear_console -q + read -p "Clear screen? " -n 1 -r + echo + if [[ $REPLY =~ ^[Yy]$ ]]; then + /usr/bin/clear_console -q + fi fi fi