1 # System-wide .bashrc file for interactive bash(1) shells.
3 # To enable the settings / commands in this file for login shells as well,
4 # this file has to be sourced in /etc/profile.
6 # NOTE: if not running interactively, don't do anything
7 [ -z "$PS1" ] && return
9 [ "${SHELL##*\/}" = bash ] && {
10 # NOTE: check the window size after each command and, if necessary,
11 # update the values of LINES and COLUMNS.
15 # NOTE: set variable identifying the chroot you work in (used in the prompt below)
16 if [ -z "$debian_chroot" ] && [ -r /etc/debian_chroot ]
17 then debian_chroot=$(cat /etc/debian_chroot)
20 # NOTE: set a fancy prompt (non-color, overwrite the one in /etc/profile)
21 #PS1='${debian_chroot:+($debian_chroot)}\u@\h:\w\$ '
23 # NOTE: séquences d’échappement du terminal
25 do declare tput_setaf_$i="$(tput setaf $i)"
27 tput_sgr0="$(tput sgr0)"
28 tput_cnorm="$(tput cnorm)"
29 tput_bold="$(tput bold)"
30 tput_rev="$(tput rev)"
32 # NOTE: met un gros curseur bleu non-clignotant dans un TTY
33 # VOIR: /usr/src/linux/Documentation/VGA-softcursor.txt
35 (*linux) prompt_set_cursor="$tput_cnorm\e[?16;0;16c" ;;
36 # NOTE: last 16 does not seem to be portable
37 # and you may have to change it to get the right color.
38 (*) prompt_set_cursor=$tput_cnorm ;;
40 prompt_set_cursor="\\[$prompt_set_cursor\\]"
41 alias prompt_errno='test $? = 0 || printf %s "$tput_setaf_1"'
42 prompt_text="\\[$tput_setaf_6\\]\\w\\[$tput_sgr0\\] \\[\$(prompt_errno)\\]\\$\\[$tput_sgr0\\] "
43 # NOTE: encapsule pour passer l’interprétation de screen
45 (screen*) [ -z "$prompt_set_cursor" ] ||
46 prompt_set_cursor="\\[\eP\\]$prompt_set_cursor\\[\e\\\\\\]"
49 # NOTE: rajoute l’hôte quand il n’y a pas screen pour l’afficher
50 prompt_text="\\[$tput_setaf_0$tput_bold\\]\\h $prompt_text"
53 . /etc/etckeeper/prompt.sh
56 local users="$(who -u | cut -d " " -f 1 | sort -u)"
57 test "$(printf "%s\n" $users | wc -l)" -lt 2 || {
58 users=$(printf "%s&" $users)
59 printf "%s@" "${users%&}"
63 prompt_text="\\[$tput_setaf_3$tput_bold\\]\$(prompt_users)\\[$tput_sgr0\\]$prompt_text"
64 prompt_text="\\[$tput_setaf_1$tput_bold\\]\$(prompt_etckeeper)\\[$tput_sgr0\\]$prompt_text"
65 PS1="$prompt_set_cursor$prompt_text"
68 eval $(dircolors --bourne-shell)
72 alias dux='du -cks * | sort -rn | head -11'
73 alias e='sudo etckeeper'
74 alias ec='sudo etckeeper commit'
75 alias ev='sudo etckeeper vcs'
91 eval "$(if [ -z "${@:+set}" ]
92 then getfacl --absolute-names ${ACLOPTS:---physical} . .. *
93 else getfacl --absolute-names ${ACLOPTS:---physical} "$@"
101 ;s/^\n\# flags: \([^ ]*\)/f:\1/
104 ;s/\s*\#effective:\(...\)$/'"$tput_setaf_1"'('"$tput_sgr0"'\1'"$tput_setaf_1"')'"$tput_sgr0"'/
105 ;s/ default:\([^:]\)[^:][^:]*:\([^:]*\):/'"$tput_setaf_0$tput_bold"' d:'"$tput_setaf_0$tput_bold"'\1:'"$tput_sgr0"'\2'"$tput_setaf_0$tput_bold"':'"$tput_sgr0"'/
106 ;s/\(^\| \)\([^:]\)[^:]*:\([^:]*\):\([^:]*\)$/\1'"$tput_setaf_0$tput_bold"'\2:'"$tput_sgr0"'\3'"$tput_setaf_0$tput_bold"':'"$tput_sgr0"'\4/
111 ;s/^f:\([^ ]*\) \([^\n]*\)/\2 '"$tput_setaf_0$tput_bold"'f:'"$tput_sgr0"'\1/
114 ;s/^\# file: \([^\n]*\)\n\# owner: \([^\n]*\)\n\# group: \([^\n]*\)\n\(.*\)/ \
115 echo -En '"'"'\2'"$tput_setaf_0$tput_bold:$tput_sgr0"'\3 \4 '"'"'; \
116 ls --color=always -d "$(echo -en '"'"'\1'"'"')"/
120 alias ls='ls -aFh -T 0 --color=auto'
121 alias mem='ps -e -orss=,user=,args= | sort -b -k1,1n'
122 alias scan='clamdscan --fdpass'
123 alias setfacl='setfacl --no-mask'
127 alias vm_hosted='~/src/vm/vm_hosted'
132 # enable bash completion in interactive shells
133 if [ -f /etc/bash_completion ]
134 then . /etc/bash_completion
137 mkdir -p ~/var/log/"${SHELL##*/}"
138 HISTFILE=~/var/log/"${SHELL##*/}"/history.log
139 HISTCONTROL=ignoreboth