Commit 8c3dadb0 authored by Dom Sekotill's avatar Dom Sekotill
Browse files

added bash configs & general shell profile

parent 7dc55665
Loading
Loading
Loading
Loading

.bash/aliases

0 → 100644
+26 −0
Original line number Diff line number Diff line
## General aliases
## ===============
#
# Some of these may be overridden in .bash/$PLATFORM/aliases
#

alias df='df -h'
alias du='du -h'
alias dix='dig -x'
alias vim='vim -p'
alias ls='ls -lh'


## Common miss-spellings
## =====================

alias gti=git

alias suod=sudo
alias sduo=sudo
alias sdou=sudo

alias pyhton=python
alias $(find ${PATH//:/ } \
	\( -iname python? -o -iname python?.? \) -printf '%P\n' \
	| sed 's/python\(.*\)/pyhton\1=python\1/')

.bash/funcs

0 → 100644
+30 −0
Original line number Diff line number Diff line
#!/bin/bash
# .bash_funcs

source_first()
{
	for sf in "$@"; do
		[ -f "$sf" ] && . "$sf" && return
	done
}

source_each()
{
	for sf in "$@"; do
		[ -f "$sf" ] && . "$sf"
	done
}

has()
{
	type "$1"
} 1>/dev/null 2>&1

get_platform()
{
	case "$OSTYPE" in
		linux-gnu) echo gnu ;;
		darwin*) echo darwin ;;
		*) echo $OSTYPE ;;
	esac
}

.bash/gnu/aliases

0 → 100644
+5 −0
Original line number Diff line number Diff line
alias ls='ls --color=auto -lh'
alias dir='dir --color=auto'
alias grep='grep --color=auto'
alias fgrep='fgrep --color=auto'
alias egrep='egrep --color=auto'

.bash_logout

0 → 100644
+6 −0
Original line number Diff line number Diff line
# ~/.bash_logout

# 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

.bash_profile

0 → 100644
+28 −0
Original line number Diff line number Diff line
# .bash_profile

. ~/.bash/funcs

export BASH_PROFILE_LOADED=1

# Disable PROMPT_COMMAND, can be re-enabled in ~/.bash_local
PROMPT_COMMAND=:

# Source all-shell startup profile environments
source_first ~/.profile /etc/profile

# Prompt
if [ -n "$PS1" ]; then
	CKSUM=$(hostname | cksum | cut -f1 -d\ )
	PROMPTCOLOUR=$(((CKSUM % 6)+31))
	PS1="\[\e[1;${PROMPTCOLOUR:-0}m\]\u@\h: \$\[\e[0m\] "
	export PS1
	unset CKSUM PROMPTCOLOUR
fi

source_each ~/.bash/$(get_platform)/profile ~/.bash_local

# Automatically run terminal multiplexer on SSH connect
[ -n "$SSH_TTY" ] && [ "x$TERM" != xscreen ] && has tmux && exec tmux -u attach

# Get Bash aliases and functions
source_first ~/.bashrc /etc/bash.bashrc /etc/bashrc
Loading