2017-03-29 17:45:16 -05:00
|
|
|
#
|
2017-10-10 10:37:30 -05:00
|
|
|
# /etc/bashrc
|
2017-03-29 17:45:16 -05:00
|
|
|
#
|
|
|
|
|
|
|
|
# If not running interactively, don't do anything
|
|
|
|
[[ $- != *i* ]] && return
|
|
|
|
|
2017-06-23 13:56:31 -05:00
|
|
|
PS1='\[\033[00;31m\][ AniNIX::\h(\[\033[01;32m\]`uname -o`\[\033[00;31m\]) \[\033[00;36m\]\u \[\033[01;37m\]\d \t \[\033[00;35m\]\w\[\033[00;31m\] ] \n|\[\033[m\]> '
|
2017-03-29 17:45:16 -05:00
|
|
|
PS2='> '
|
|
|
|
PS3='> '
|
|
|
|
PS4='+ '
|
|
|
|
|
|
|
|
case ${TERM} in
|
|
|
|
xterm*|rxvt*|Eterm|aterm|kterm|gnome*)
|
|
|
|
PROMPT_COMMAND=${PROMPT_COMMAND:+$PROMPT_COMMAND; }'printf "\033]0;AniNIX::%s \134\134 %s in %s\007" "${HOSTNAME%%.*}" "${USER}" "${PWD/#$HOME/\~}"'
|
|
|
|
|
|
|
|
;;
|
|
|
|
screen)
|
|
|
|
PROMPT_COMMAND=${PROMPT_COMMAND:+$PROMPT_COMMAND; }'printf "\033]0;AniNIX::%s \134\134 %s in %s\007" "${HOSTNAME%%.*}" "${USER}" "${PWD/#$HOME/\~}"'
|
|
|
|
;;
|
|
|
|
esac
|
|
|
|
|
2017-10-10 10:37:30 -05:00
|
|
|
# Considered untrusted.
|
|
|
|
# https://bugs.archlinux.org/task/55841
|
2017-10-26 21:53:13 -05:00
|
|
|
#[ -r /usr/share/bash-completion/bash_completion ] && . /usr/share/bash-completion/bash_completion
|
2017-03-29 17:45:16 -05:00
|
|
|
|
|
|
|
[ -f /etc/bash.motd ] && cat /etc/bash.motd
|
|
|
|
|
|
|
|
### AniNIX Customizations ###
|
|
|
|
alias get-commands='for i in $( echo $PATH | sed "s/:/\n/g"); do ls $i; done | sort | less'
|
|
|
|
alias whoison='who | grep -v tmux'
|
|
|
|
alias startvnc="vncserver -xstartup startxfce4; echo Use \"ssh -L 5901:localhost:5901 $(whoami)@$(hostname)\" to tunnel connections."
|
|
|
|
alias vi=vim
|
|
|
|
alias view="vim -R"
|
|
|
|
alias top="top -o %CPU"
|
|
|
|
alias make-entrypoints="egrep '^[a-zA-Z0-9\-]*:' Makefile"
|
2017-10-25 23:50:52 -05:00
|
|
|
if [ -x `which torsocks 2>/dev/null` ] && [ `systemctl status tor 2>/dev/null| grep -c running` -eq 1 ]; then
|
|
|
|
alias tor-lynx="torsocks lynx https://check.torproject.org/";
|
|
|
|
fi
|
2017-03-29 17:45:16 -05:00
|
|
|
|
|
|
|
IFS="
|
|
|
|
"
|
|
|
|
|
|
|
|
# Irssi
|
2017-05-02 11:20:06 -05:00
|
|
|
for i in `ls -d ~/.irssi-* 2>/dev/null`; do
|
2017-03-29 17:45:16 -05:00
|
|
|
alias `echo $i | cut -f 2 -d '-' | tr '[:upper:]' '[:lower:]'`="irssi --home=$i";
|
|
|
|
done
|
|
|
|
|
2017-10-10 10:37:30 -05:00
|
|
|
# SSH
|
|
|
|
for i in `egrep '^Host' ~/.ssh/config | cut -f 2 -d ' '`; do
|
|
|
|
alias "$i"="ssh $i";
|
|
|
|
done
|
|
|
|
|
|
|
|
# Set up screen/tmux safety nest by default for remote sessions
|
|
|
|
if [ ! -z "$SSH_CLIENT" ]; then
|
2017-03-29 17:45:16 -05:00
|
|
|
if [ -x "$(which tmux 2>/dev/null)" ] && [ -z "$TMUX" ]; then
|
|
|
|
if [ `tmux list-sessions | grep created | wc -l` -eq 0 ]; then
|
|
|
|
exec tmux
|
|
|
|
elif [ `tmux list-sessions | grep created | wc -l` -eq 1 ] && [ `tmux list-sessions | grep attached | wc -l` -eq 0 ]; then
|
|
|
|
exec tmux a -d -t `tmux list-sessions | grep created | cut -f 1 -d ':'`
|
2017-10-10 10:37:30 -05:00
|
|
|
else
|
|
|
|
tmux list-sessions
|
|
|
|
fi
|
2017-06-23 13:56:31 -05:00
|
|
|
alias tat="exec tmux a -d -t"
|
2017-03-29 17:45:16 -05:00
|
|
|
elif [ -x "$(which screen 2>/dev/null)" ] && [ "$TERM" != "screen" ]; then
|
|
|
|
if [ `screen -list | grep -c 'Detached'` -eq 1 ]; then
|
|
|
|
exec screen -r
|
|
|
|
elif [ `screen -list | grep -c 'No Sockets found in '` -eq 1 ] && [ "$TERM" != "screen" ]; then
|
|
|
|
exec /usr/bin/screen /bin/bash
|
2017-10-10 10:37:30 -05:00
|
|
|
else
|
|
|
|
screen -list
|
|
|
|
fi
|
2017-03-29 17:45:16 -05:00
|
|
|
alias sdr="screen -d -r"
|
|
|
|
fi;
|
2017-10-26 21:53:13 -05:00
|
|
|
elif [ `who -m | egrep "^$(whoami)" | awk '{ print $2; }' | egrep -c "^tty"` -eq 1 ] && [ -x /usr/sbin/startxfce4 ] && [ `pgrep -ac xinit` -eq 0 ]; then
|
2017-10-25 23:50:52 -05:00
|
|
|
exec startxfce4
|
2017-03-29 17:45:16 -05:00
|
|
|
fi
|
2017-10-25 23:50:52 -05:00
|
|
|
|