From c041421e766af496e7c78997a235d889352e7e6e Mon Sep 17 00:00:00 2001 From: Eric Renfro Date: Thu, 14 Mar 2024 21:49:14 -0400 Subject: [PATCH] Finished updating bashrc and others --- .bash_logout | 4 ++++ .bash_profile | 15 +++++++++++++++ .bashrc | 11 ++++++++++- .shell-logout | 27 +++++++++++++++++++++++++++ 4 files changed, 56 insertions(+), 1 deletion(-) create mode 100644 .bash_logout create mode 100644 .bash_profile create mode 100644 .shell-logout diff --git a/.bash_logout b/.bash_logout new file mode 100644 index 0000000..242cd81 --- /dev/null +++ b/.bash_logout @@ -0,0 +1,4 @@ +# ~/.bash_logout: executed by bash(1) when login shell exits. + +test -r ~/.shell-logout && source ~/.shell-logout + diff --git a/.bash_profile b/.bash_profile new file mode 100644 index 0000000..7ded4bb --- /dev/null +++ b/.bash_profile @@ -0,0 +1,15 @@ +# Via https://tanguy.ortolo.eu/blog/article25/shrc +# +# At startup, depending on the case: +# - run as a login shell (or with the option --login), it executes profile (or +# bash_profile instead if it exists (only user-specific version)); +# - run as an interactive, non-login shell, it executes bashrc (the system-wide +# version is called bash.bashrc). +# +# At exit, it executes ~/.bash_logout (the system-wide version is called +# bash.bash_logout). +# Note the funny (read: insane) non-login condition for executing bashrc: it is +# often worked around by having the profile execute bashrc anyway. + +[[ -f ~/.profile ]] && . ~/.profile + diff --git a/.bashrc b/.bashrc index 737ded1..a7624db 100644 --- a/.bashrc +++ b/.bashrc @@ -1,6 +1,15 @@ +# Via https://tanguy.ortolo.eu/blog/article25/shrc # -# ~/.bashrc +# At startup, depending on the case: +# - run as a login shell (or with the option --login), it executes profile (or +# bash_profile instead if it exists (only user-specific version)); +# - run as an interactive, non-login shell, it executes bashrc (the system-wide +# version is called bash.bashrc). # +# At exit, it executes ~/.bash_logout (the system-wide version is called +# bash.bash_logout). +# Note the funny (read: insane) non-login condition for executing bashrc: it is +# often worked around by having the profile execute bashrc anyway. # If not running interactively, don't do anything [[ $- != *i* ]] && return diff --git a/.shell-logout b/.shell-logout new file mode 100644 index 0000000..e438ffe --- /dev/null +++ b/.shell-logout @@ -0,0 +1,27 @@ +# vim: set ft=sh sw=2 et : + +# when leaving the console clear the screen to increase privacy + +if [ "$SHLVL" = 1 ]; then + [ -x /usr/bin/clear_console ] && /usr/bin/clear_console -q +fi + +# When leaving the console clear the screen to increase privacy. Also clear the +# scroll-back buffer by switching to tty63 and back. +case "$(tty)" in + /dev/tty[0-9]) + t=$(v=`tty` ; echo ${v##*ty}) + clear + chvt 63; chvt "$t" + ;; + + /dev/tty[0-9][0-9]) + t=$(v=`tty` ; echo ${v##*ty}) + clear + chvt 63; chvt "$t" + ;; + + *) + ;; +esac +