]> code.delx.au - dotfiles/blob - .bash/interactive
/etc/debian_chroot is put in the prompt
[dotfiles] / .bash / interactive
1 #! bash
2
3 # Sets up the shell for interactive commands
4
5 # Use the terminfo backspace character as the erase character. This is not
6 # enabled by default because terminfo is often broken.
7 #stty erase $(tput kbs)
8
9 # The contents of /etc/debian_chroot will be printed in the prompt. You can
10 # create this file in chroot environments to know where you are.
11 if [ -z "$debian_chroot" -a -r /etc/debian_chroot ]; then
12 debian_chroot=$(cat /etc/debian_chroot)
13 fi
14
15 # Prompt: user@host:directory$
16 PS1='${debian_chroot:+($debian_chroot)}\u@\h:\w\$ '
17
18 # The all important colours!
19 ssource "${HOME}/.bash/colors"
20
21 # xterm titlebar displays current command
22 case "${TERM}" in
23 xterm*|rxvt*)
24 HOSTNAME="$(hostname | cut -d '.' -f 1)"
25 CWD_WITHHOME='"$(echo "${PWD}" | sed "s|^${HOME}|~|")"'
26 PROMPT_COMMAND="echo -ne \"\033]0;${HOSTNAME}: ${CWD_WITHHOME}\007\""
27 unset HOSTNAME
28 ;;
29 screen*)
30 PROMPT_COMMAND="echo -ne '\033k\033\\'"
31 ;;
32 *)
33 ;;
34 esac
35
36 # Useful aliases
37 alias ls='ls --color=auto'
38 alias ll='ls -hlF'
39 alias la='ls -ha'
40 alias l='ls -halF'
41 alias rm='rm -i'
42 alias less='less -R'
43 alias grep='grep --color=auto'
44
45 # Bash should check the terminal size after every command terminates
46 shopt -s checkwinsize
47 # Don't attempt to tab-complete an empty line
48 shopt -s no_empty_cmd_completion
49
50 # Local customisations
51 ssource "${HOME}/.bash/interactive_local"
52
53 # Load bash completion if available
54 ssource "/etc/bash_completion"
55