]> arthur.barton.de Git - ax-zsh.git/commitdiff
byebye: Clear the console on logout if it is a local tty
authorAlexander Barton <alex@barton.de>
Sun, 19 Jul 2015 13:51:02 +0000 (15:51 +0200)
committerAlexander Barton <alex@barton.de>
Sun, 19 Jul 2015 13:51:02 +0000 (15:51 +0200)
plugins/byebye/byebye.zlogout

index 7c06d387d99e21aac8197772aa76cfb562385152..06df9c505e07e42da3febff9a5a555b6af8f527e 100644 (file)
@@ -1,5 +1,15 @@
 # AX-ZSH: Alex' Modular ZSH Configuration
 # byebye.zlogout -- Say goodbye to interactive users
 
-[[ -o interactive ]] \
-       && echo "Bye, bye, $LOGNAME!"
+[[ -o interactive ]] || return
+
+# Clear the console if it is a local terminal
+case `tty` in
+    /dev/tty[0-9]*|/dev/ttyS[0-9]*)
+       [[ -x /usr/bin/clear_console ]] \
+               && /usr/bin/clear_console --quiet \
+               || clear
+       ;;
+    *)
+       echo "Bye, bye, $LOGNAME!"
+esac