|
| 1 | +# System-wide .bashrc file for interactive bash(1) shells. |
| 2 | + |
| 3 | +# Bash is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version. |
| 4 | + |
| 5 | +# To enable the settings / commands in this file for login shells as well, |
| 6 | +# this file has to be sourced in /etc/profile. |
| 7 | + |
| 8 | +# If not running interactively, don't do anything |
| 9 | +[ -z "$PS1" ] && return |
| 10 | + |
| 11 | +# check the window size after each command and, if necessary, |
| 12 | +# update the values of LINES and COLUMNS. |
| 13 | +shopt -s checkwinsize |
| 14 | + |
| 15 | +# set variable identifying the chroot you work in (used in the prompt below) |
| 16 | +if [ -z "${debian_chroot:-}" ] && [ -r /etc/debian_chroot ]; then |
| 17 | + debian_chroot=$(cat /etc/debian_chroot) |
| 18 | +fi |
| 19 | + |
| 20 | +# set a fancy prompt (non-color, overwrite the one in /etc/profile) |
| 21 | +# but only if not SUDOing and have SUDO_PS1 set; then assume smart user. |
| 22 | +if ! [ -n "${SUDO_USER}" -a -n "${SUDO_PS1}" ]; then |
| 23 | + PS1='${debian_chroot:+($debian_chroot)}\u@\h:\w\$ ' |
| 24 | +fi |
| 25 | + |
| 26 | +# Commented out, don't overwrite xterm -T "title" -n "icontitle" by default. |
| 27 | +# If this is an xterm set the title to user@host:dir |
| 28 | +#case "$TERM" in |
| 29 | +#xterm*|rxvt*) |
| 30 | +# PROMPT_COMMAND='echo -ne "\033]0;${USER}@${HOSTNAME}: ${PWD}\007"' |
| 31 | +# ;; |
| 32 | +#*) |
| 33 | +# ;; |
| 34 | +#esac |
| 35 | + |
| 36 | +# enable bash completion in interactive shells |
| 37 | +#if ! shopt -oq posix; then |
| 38 | +# if [ -f /usr/share/bash-completion/bash_completion ]; then |
| 39 | +# . /usr/share/bash-completion/bash_completion |
| 40 | +# elif [ -f /etc/bash_completion ]; then |
| 41 | +# . /etc/bash_completion |
| 42 | +# fi |
| 43 | +#fi |
| 44 | + |
| 45 | +# sudo hint |
| 46 | +if [ ! -e "$HOME/.sudo_as_admin_successful" ] && [ ! -e "$HOME/.hushlogin" ] ; then |
| 47 | + case " $(groups) " in *\ admin\ *|*\ sudo\ *) |
| 48 | + if [ -x /usr/bin/sudo ]; then |
| 49 | + cat <<-EOF |
| 50 | + To run a command as administrator (user "root"), use "sudo <command>". |
| 51 | + See "man sudo_root" for details. |
| 52 | + |
| 53 | + EOF |
| 54 | + fi |
| 55 | + esac |
| 56 | +fi |
| 57 | + |
| 58 | +# if the command-not-found package is installed, use it |
| 59 | +if [ -x /usr/lib/command-not-found -o -x /usr/share/command-not-found/command-not-found ]; then |
| 60 | + function command_not_found_handle { |
| 61 | + # check because c-n-f could've been removed in the meantime |
| 62 | + if [ -x /usr/lib/command-not-found ]; then |
| 63 | + /usr/lib/command-not-found -- "$1" |
| 64 | + return $? |
| 65 | + elif [ -x /usr/share/command-not-found/command-not-found ]; then |
| 66 | + /usr/share/command-not-found/command-not-found -- "$1" |
| 67 | + return $? |
| 68 | + else |
| 69 | + printf "%s: command not found\n" "$1" >&2 |
| 70 | + return 127 |
| 71 | + fi |
| 72 | + } |
| 73 | +fi |
| 74 | + |
| 75 | +# Display CRITICAL ALERT on launch |
| 76 | +grep -v '^\.\. ' /CRITICAL_ALERT.rst |
0 commit comments