]> ruderich.org/simon Gitweb - config/dotfiles.git/blob - bash/rc
bash/rc: Documentation update.
[config/dotfiles.git] / bash / rc
1 # Main bash configuration file.
2 #
3 # Is sourced by all interactive shells and other shells like scp or rcp.
4
5
6 # Get the current hostname (first part before a dot).
7 host=$(echo $(hostname) | sed -e 's/\..*$//')
8
9 # Load environmental related settings used by all shells.
10 if [ -f ~/.shell/env ]; then
11     . ~/.shell/env
12 # Fallback functions as ~/.shell/env couldn't be loaded.
13 else
14     function source_debug() {
15         echo $@
16     }
17     function source_config() {
18         echo "Couldn't load source_config(), can't source files." >&2
19     }
20 fi
21
22 source_debug "sourcing ~/.bash/rc"
23
24 # Load global env file for current hostname (first part before a dot) or
25 # global env.local.
26 source_config ~/.shell "" env $host
27
28
29 # Check if this is an interactive shell. Abort if not to prevent problems with
30 # scp and rcp. Taken from default Debian bashrc. Thanks.
31 if [[ $- != *i* ]]; then
32     return
33 fi
34
35
36 # Set the prompt; hostname and current working directory are displayed.
37 # Hostname is displayed in green, current directory in blue.
38 PS1='\[\033[01;32m\]\h\[\033[00m\]:\[\033[01;34m\]\w\[\033[00m\] \$ '
39
40 # Use Vi(m) style in bash.
41 set -o vi
42
43 # Load aliases and similar functions also used by other shells.
44 if [[ -f ~/.shell/aliases ]]; then
45     . ~/.shell/aliases
46 fi
47
48
49 # Load rc file for current hostname (first part before a dot) or rc.local.
50 source_config ~/.bash host rc $host
51
52 source_debug "finished sourcing ~/.bash/env"
53
54 # vim: ft=sh