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