From aa984c6a0733adf84acc3e63543ac32d382c76cb Mon Sep 17 00:00:00 2001 From: David Tomaschik Date: Mon, 10 Feb 2014 17:48:40 -0500 Subject: [PATCH] Push aliases to their own file. --- aliases | 17 +++++++++++++++++ bashrc | 5 ----- profile | 10 ++-------- 3 files changed, 19 insertions(+), 13 deletions(-) create mode 100644 aliases diff --git a/aliases b/aliases new file mode 100644 index 0000000..1455893 --- /dev/null +++ b/aliases @@ -0,0 +1,17 @@ +# General aliases, should only be sourced in interactive shells + +# Add an "alert" alias for long running commands. Use like so: +# sleep 10; alert +alias alert='notify-send --urgency=low -i "$([ $? = 0 ] && echo terminal || echo error)" "$(history|tail -n1|sed -e '\''s/^\s*[0-9]\+\s*//;s/[;&|]\s*alert$//'\'')"' + +# Cryptsetup alias +alias luksFormat='sudo cryptsetup luksFormat -s 512 -c aes-xts-plain --use-random -h sha256 -i 5000' + +# Colors +alias ls='ls --color=auto' +alias grep='grep --color=auto' +alias egrep='egrep --color=auto' +alias fgrep='fgrep --color=auto' + +# Timestamp in a machine-sortable form +alias tstamp="date '+%Y%m%d-%H%M%S'" diff --git a/bashrc b/bashrc index 541a70f..e1f0c64 100644 --- a/bashrc +++ b/bashrc @@ -37,13 +37,8 @@ xterm*|rxvt*) ;; esac -# enable color support of ls and also add handy aliases if [ -x /usr/bin/dircolors ]; then test -r ~/.dircolors && eval "$(dircolors -b ~/.dircolors)" || eval "$(dircolors -b)" - alias ls='ls --color=auto' - alias grep='grep --color=auto' - alias fgrep='fgrep --color=auto' - alias egrep='egrep --color=auto' fi # Bash completion diff --git a/profile b/profile index 0139aeb..9e4fde2 100644 --- a/profile +++ b/profile @@ -32,11 +32,5 @@ unset GPG_AGENT_INFO_PATH export GPG_TTY=`tty` # End GPG -# Add an "alert" alias for long running commands. Use like so: -# sleep 10; alert -alias alert='notify-send --urgency=low -i "$([ $? = 0 ] && echo terminal || echo error)" "$(history|tail -n1|sed -e '\''s/^\s*[0-9]\+\s*//;s/[;&|]\s*alert$//'\'')"' - -# Cryptsetup alias -alias luksFormat='sudo cryptsetup luksFormat -s 512 -c aes-xts-plain --use-random -h sha256 -i 5000' - -if [ -f $HOME/.localenv ] ; then source $HOME/.localenv ; fi +if [ -e $HOME/.localenv ] ; then source $HOME/.localenv ; fi +if [[ $- == *i* ]] && [[ -e $HOME/.aliases ]] ; then source $HOME/.aliases ; fi