Clear screen only after confirmation

This commit is contained in:
Alexander Hess 2024-06-06 19:10:46 +02:00
parent 8ebea88538
commit 31a993b62a
Signed by: alexander
GPG key ID: 344EA5AB10D868E0

View file

@ -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
read -p "Clear screen? " -n 1 -r
echo
if [[ $REPLY =~ ^[Yy]$ ]]; then
/usr/bin/clear
fi
elif [ -x /usr/bin/clear_console ]; then
read -p "Clear screen? " -n 1 -r
echo
if [[ $REPLY =~ ^[Yy]$ ]]; then
/usr/bin/clear_console -q
fi
fi
fi