Public feed #891952

Miscellany

public text v1 · immutable
Raw Edit
·published 2008-02-05 01:05 UTC
rendered paste body
# /etc/skel/.bashrc
#
# This file is sourced by all *interactive* bash shells on startup,
# including some apparently interactive shells such as scp and rcp
# that can't tolerate any output.  So make sure this doesn't display
# anything or bad things will happen !

# Test for an interactive shell.  There is no need to set anything
# past this point for scp and rcp, and it's important to refrain from
# outputting anything in those cases.
# ~/.bashrc by eax
if [[ $- != *i* ]] ; then
        # Shell is non-interactive.  Be done now!
        return
fi

# Put your fun stuff here.
export TERM=xterm-color;

# [-------------]
# [---Colors----]
# [-------------]
RED='\e[0;31m'
LIGHT_RED='\e[1;31m'
BLUE='\e[0;34m'
LIGHT_BLUE='\e[1;34m'
CYAN='\e[0;36m'
LIGHT_CYAN='\e[1;36m'
GREEN='\e[0;32m'
LIGHT_GREEN='\e[0;32m'
GREY='\e[00m'
NO_COLOR='\e[0m'
C1=$GREY
C2=$LIGHT_GREEN

# [------------]
# [--Terminal--]
# [------------]
echo -e "${C1}Welcome to ${C2}${HOSTNAME}${C1},${C2} ${USER}${C1}."
echo -e "${C1}This system runs the kernel ${C2}$(uname -r) $(uname -v)${C1} (${C2}$(uname -s)${C1})."
echo -e "${C1}Operative System: ${C2}$(uname -r)${C1}"
unset PROMPT_COMMAND
case $TERM in
        *term* | rxvt)
                export PS1="$C1($C2\u$C1@$C2\h$C1) ($C2\w$C1)$NC \$$NC "
                ;;
        *)
                export PS1="(\u@\h) (\w) $ "
                ;;
        esac

# [------------]
# [-Completion-]
# [------------]

if [ "${BASH_VERSION%.*}" \< "2.05" ]; then
        echo "${C1}You will ${C2}need${C1} to ${C2}upgrade${C1} to version ${C2}2.05${C1} for programmable completion"
        return
fi

# [-----------]
# [-Functions-]
# [-----------]

function _exit() {
        echo -e "${C1}Bye,${C2} ${USER}${C1}.${NC}"
        echo -e "${C1}Uptime:${C2} $(uptime)${C1}."
        echo -e "${C1}Date:${C2} $(date)${C1}."
        echo -e "${C1}Working Directory:${C2} $(pwd)${C1}."
}
trap _exit EXIT

function xtitle () {
case "$TERM" in
        *term* | rxvt)
                echo -n -e "\033]0;$*\007"
                ;;
        *)
        ;;
        esac
}

xtitle $(whoami)@$(hostname) - $(pwd)