Created
January 29, 2009 19:30
-
-
Save demonbane/54695 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# This requires modifications to your personal .bashrc as well as | |
# root's .bashrc (and changes to the sudo setup). It is dirty and | |
# should not ever be used by anyone. Ever. :) | |
########## personal .bashrc ############# | |
# If not running interactively, don't do anything | |
[ -z "$PS1" ] && return | |
# don't put duplicate lines in the history. See bash(1) for more options | |
export HISTCONTROL=ignoredups | |
# check the window size after each command and, if necessary, | |
# update the values of LINES and COLUMNS. | |
shopt -s checkwinsize | |
# make less more friendly for non-text input files, see lesspipe(1) | |
[ -x /usr/bin/lesspipe ] && eval "$(lesspipe)" | |
# set variable identifying the chroot you work in (used in the prompt below) | |
if [ -z "$debian_chroot" ] && [ -r /etc/debian_chroot ]; then | |
debian_chroot=$(cat /etc/debian_chroot) | |
fi | |
# set a fancy prompt | |
PS1='${debian_chroot:+($debian_chroot)}\u@\h:\w\$ ' | |
# If this is an xterm set the title to user@host:dir | |
case "$TERM" in | |
xterm*|rxvt*) | |
PROMPT_COMMAND='echo -ne "\033]0;${USER}@${HOSTNAME}: ${PWD/$HOME/~}\007"' | |
;; | |
*) | |
;; | |
esac | |
# enable color support of ls and also add handy aliases | |
if [ "$TERM" != "dumb" ]; then | |
eval "`dircolors -b`" | |
alias ls='ls --color=always -lh' | |
export LESS=-RX | |
fi | |
# enable programmable completion features (you don't need to enable | |
# this, if it's already enabled in /etc/bash.bashrc and /etc/profile | |
# sources /etc/bash.bashrc). | |
if [ -f /etc/bash_completion ]; then | |
. /etc/bash_completion | |
fi | |
if [ -f ~/.letmein ]; then | |
echo "Skipping sudo login, will resume on next login." | |
IMINSUDO=1 | |
rm -f ~/.letmein | |
fi | |
if [ "$IMINSUDO" != "1" ]; then | |
HOME=/root sudo -E -i | |
HOME=/home/$USER | |
exit 0 | |
fi | |
############## root's .bashrc ############### | |
if [ -f /home/$SUDO_USER/.bashrc ]; then | |
IMINSUDO=1 | |
source /home/$SUDO_USER/.bashrc | |
return 0 | |
fi | |
# If you're logging in as yourself, the following | |
# commands will never get executed. They are just | |
# the defaults for "other" root users. | |
export PS1='\h:\w\$ ' | |
umask 022 | |
# Some more aliases to avoid making mistakes: | |
alias rm='rm -i' | |
alias cp='cp -i' | |
alias mv='mv -i' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment