-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy path.bash_logout.seb
30 lines (25 loc) · 1.43 KB
/
.bash_logout.seb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
# vim: ft=bash noet:
! declare 2>&1 | \grep -wq ^colors= && [ $BASH_VERSINFO -ge 4 ] && source $initDir/.colors
test "$debug" -gt 0 && echo "=> Running $bold${colors[blue]}$(basename ${BASH_SOURCE[0]})$normal ..."
test -z "$SSH_CONNECTION" && \pgrep -u $USER -f "adb -." >/dev/null && Echo "=> Killing the <adb> process ..." && pkill -f "adb -. "
if command df ~/.cache | \egrep -wqi "/(home|users?)";then
if [ $osID != sailfishos ]; then
tty -s && echo "=> Removing everything in ~/.cache/ except the <fontconfig> cache which is also used by matplotlib."
command find ~/.cache/ -type d | \egrep -vw "(.cache/|fontconfig|matplotlib)" | \xargs rm -fr
command find ~/.cache/ -type f | \egrep -v "/(fontconfig|matplotlib)/" | \xargs rm -f
tty -s && echo "=> Done."
fi
fi 2>/dev/null
#defaultPrinter=$(lpstat -d | awk '{print$NF}')
#for printerInstance in $(lpstat -a | awk '{if($1 ~ /\//) print$1}')
#do
# lpoptions -x $printerInstance
#done
# For security reasons
[ $osFamily = Linux ] && [ $(hostname) != ssh ] && [ -n "$SSH_AGENT_PID" ] && [ $(who | grep -c $USER) -le 2 ] && [ $(\ps -C bash -o pid= | wc -l) = 1 ] && Echo "=> Stopping the ssh-agent ..." && eval $(ssh-agent -k)
sleepTimeout=0.5
interuptTimeout=$(echo $sleepTimeout | awk \$1*=2)
exitTimeout=$(echo $sleepTimeout | awk \$1*=10)
Echo "=> Sleeping $sleepTimeout before finish ..."
set +x
test "$debug" -gt 0 && echo "=> END of $bold${colors[blue]}$(basename ${BASH_SOURCE[0]})$normal"