2022-05-09 14:37:39 +01:00
|
|
|
#!/bin/bash
|
|
|
|
|
2016-06-16 10:26:04 +01:00
|
|
|
#--------------------------------------------------------------------------------
|
|
|
|
# Exit for non-interactive sessions
|
|
|
|
#--------------------------------------------------------------------------------
|
|
|
|
if [ -z "$PS1" ]; then
|
|
|
|
return
|
|
|
|
fi
|
|
|
|
#--------------------------------------------------------------------------------
|
|
|
|
|
2016-02-16 20:19:31 +00:00
|
|
|
#--------------------------------------------------------------------------------
|
|
|
|
# Function to prepend PATH only if it doesn't already exist
|
|
|
|
#--------------------------------------------------------------------------------
|
2016-02-16 19:20:07 +00:00
|
|
|
pathadd() {
|
|
|
|
if [ -d "$1" ] && [[ ":$PATH:" != *":$1:"* ]]; then
|
|
|
|
PATH="$1${PATH:+":$PATH"}"
|
|
|
|
fi
|
|
|
|
}
|
2016-02-16 20:19:31 +00:00
|
|
|
#--------------------------------------------------------------------------------
|
2016-02-16 19:20:07 +00:00
|
|
|
|
2014-11-11 21:13:52 +00:00
|
|
|
#--------------------------------------------------------------------------------
|
2014-11-11 21:01:06 +00:00
|
|
|
# The best editor
|
2014-11-11 21:13:52 +00:00
|
|
|
#--------------------------------------------------------------------------------
|
2016-08-30 14:31:47 +01:00
|
|
|
export EDITOR=vim
|
2016-10-05 14:30:59 +01:00
|
|
|
alias vi='vim'
|
2014-11-11 21:13:52 +00:00
|
|
|
#--------------------------------------------------------------------------------
|
2014-11-11 21:01:06 +00:00
|
|
|
|
2015-01-14 11:12:25 +00:00
|
|
|
#--------------------------------------------------------------------------------
|
|
|
|
# Make less use visual bell
|
|
|
|
#--------------------------------------------------------------------------------
|
|
|
|
export LESS="-qr"
|
|
|
|
#--------------------------------------------------------------------------------
|
|
|
|
|
2016-01-26 15:38:37 +00:00
|
|
|
#--------------------------------------------------------------------------------
|
|
|
|
# Default directories
|
|
|
|
#--------------------------------------------------------------------------------
|
|
|
|
mkdir -p ~/src ~/tmp ~/var/log
|
|
|
|
#--------------------------------------------------------------------------------
|
|
|
|
|
2014-11-11 21:13:52 +00:00
|
|
|
#--------------------------------------------------------------------------------
|
2014-11-11 21:01:06 +00:00
|
|
|
# Update the path with local overrides
|
2014-11-11 21:13:52 +00:00
|
|
|
#--------------------------------------------------------------------------------
|
2016-02-16 19:20:07 +00:00
|
|
|
pathadd /usr/local/sbin
|
|
|
|
pathadd /usr/local/bin
|
2022-05-09 14:37:39 +01:00
|
|
|
pathadd ~/.local/bin
|
2016-02-16 19:20:07 +00:00
|
|
|
pathadd ~/bin
|
2014-11-11 21:13:52 +00:00
|
|
|
#--------------------------------------------------------------------------------
|
2014-11-11 21:01:06 +00:00
|
|
|
|
2014-11-11 21:13:52 +00:00
|
|
|
#--------------------------------------------------------------------------------
|
|
|
|
# A useful prompt
|
|
|
|
#--------------------------------------------------------------------------------
|
2019-01-16 11:52:40 +00:00
|
|
|
function __PROMPT_COMMAND() {
|
|
|
|
history -a
|
|
|
|
echo -ne "\033]0;${USER}@${HOSTNAME}: ${PWD}\007"
|
|
|
|
}
|
|
|
|
|
2015-09-14 18:26:36 +01:00
|
|
|
export PS1="[\u@\h \W \[\033[32m\]\$(git branch 2> /dev/null | sed -e '/^[^*]/d' -e 's/* \(.*\)/ <\1>/')\[\033[00m\]]\\$ "
|
2019-01-26 14:07:17 +00:00
|
|
|
export PROMPT_COMMAND=__PROMPT_COMMAND
|
2014-11-11 21:13:52 +00:00
|
|
|
#--------------------------------------------------------------------------------
|
|
|
|
|
|
|
|
#--------------------------------------------------------------------------------
|
2016-07-16 16:46:14 +01:00
|
|
|
# Command alias functions
|
2014-11-11 21:13:52 +00:00
|
|
|
#--------------------------------------------------------------------------------
|
2022-05-09 14:37:39 +01:00
|
|
|
GIT_SSH_COMMAND="$(which ssh) -o RemoteCommand=none"
|
|
|
|
export GIT_SSH_COMMAND
|
2016-01-26 15:49:00 +00:00
|
|
|
#--------------------------------------------------------------------------------
|
2018-09-02 11:23:53 +01:00
|
|
|
|
|
|
|
#--------------------------------------------------------------------------------
|
2019-01-20 16:16:17 +00:00
|
|
|
# Include deployed bash config
|
2018-09-02 11:23:53 +01:00
|
|
|
#--------------------------------------------------------------------------------
|
2019-01-21 13:53:10 +00:00
|
|
|
for include in ~/.bashrc.d/*; do
|
2022-05-09 14:37:39 +01:00
|
|
|
source "${include}"
|
2019-01-21 13:53:10 +00:00
|
|
|
done
|
2018-09-02 11:23:53 +01:00
|
|
|
#--------------------------------------------------------------------------------
|