]> arthur.barton.de Git - ConfigScripts.git/blob - sys/bashrc
Use "printf" instead of "echo -ne"
[ConfigScripts.git] / sys / bashrc
1 #
2 # /etc/bash.bashrc: System-wide rc file for interactive bash(1) shells.
3 #
4
5 [ -e /tmp/ConfigDebug.$USER ] && echo " >> /etc/bash.bashrc ..."
6
7 BASHRCREAD="true"
8
9 [ -z "$PROFILEREAD" -a -r /etc/profile ] && source /etc/profile
10
11 # Interactive shell?
12 if [ ! "$PS1" ]; then
13         [ -r "/var/lib/$ME/bash.bashrc" ] && source /var/lib/$ME/bash.bashrc
14         return
15 fi
16
17 # Shell options
18 shopt -s checkwinsize
19 shopt -s cdspell
20 shopt -s histappend
21 set mark-directories on
22 set mark-symlinked-directories on
23 HISTCONTROL=ignoredups
24
25 # Shell functions
26 sshnew() {
27         ssh -o "StrictHostKeyChecking no" "$@"
28 }
29 sshtmp() {
30         ssh -o "StrictHostKeyChecking no" -o "UserKnownHostsFile /dev/null" "$@"
31 }
32
33 # Shell prompt
34 prefix="${chroot_name:+($chroot_name)}"
35 [ "$UID" -eq 0 ] \
36         && PS1="${prefix}\h:\w \\\$ " \
37         || PS1="${prefix}\u@\h:\w \\\$ "
38
39 # Enable bash completion, if available
40 [ -z "$BASH_COMPLETION" -a -r /etc/bash_completion ] \
41         && source /etc/bash_completion
42 [ -z "$BASH_COMPLETION" -a -r /opt/local/etc/bash_completion ] \
43         && source /opt/local/etc/bash_completion
44
45 # If the command-not-found package is installed, use it
46 if [ -x /usr/lib/command-not-found ]; then
47         function command_not_found_handle {
48                 # Check because c-n-f could've been removed in the meantime
49                 if [ -x /usr/lib/command-not-found ]; then
50                         /usr/bin/python /usr/lib/command-not-found -- $1
51                         return $?
52                 else
53                         return 127
54                 fi
55         }
56 fi
57
58 # Common command aliases
59 alias ","="clear && logout"
60 alias ".."="cd .."
61 alias "ls"="ls -F"
62 alias "ll"="ls -l"
63 alias "l"="ll -a"
64 alias "lasth"="last | head -n \`expr \\\$LINES - 2\`"
65
66 # less filter
67 type -p lesspipe >/dev/null 2>&1 && eval `lesspipe`
68
69 # Enable color support of ls and also add handy aliases
70 if [ "$TERM" != "dumb" ]; then
71         type -p dircolors >/dev/null 2>&1 && eval `dircolors -b`
72         ls --color / >/dev/null 2>&1
73         if [ $? -eq 0 ]; then
74                 # "GNU style"
75                 alias ls="ls --color=auto -F"
76         else
77                 ls -G / >/dev/null 2>&1
78                 if [ $? -eq 0 ]; then
79                         # "BSD style"
80                         alias ls="ls -FG"
81                 fi
82         fi
83 fi
84
85 # If this is an xterm set the title to user@host:dir
86 case $TERM in
87 xterm*|rxvt|screen)
88         PROMPT_COMMAND='printf "\033]0;${USER}@${HOSTNAME}: ${PWD}\007"'
89         ;;
90 *)
91         ;;
92 esac
93
94 # Source local files, if readable
95 [ -r "/etc/bashrc.local" ] && source /etc/bashrc.local
96 [ -r "/etc/bash.bashrc.local" ] && source /etc/bash.bashrc.local
97 [ -r "/var/lib/$ME/bash.bashrc" ] && source /var/lib/$ME/bash.bashrc
98
99 # -eof-