# /etc/bashrc # ##################################################################### # Basic bash startup files explanation: # # /etc/profile ==> System-wide initialization file containing global/system # environment variables and startup programs # /etc/bashrc ==> System-wide aliases and functions, and some modifications to # /etc/profile (to help maintain /etc/profile as original as possible) # ~/.bash_profile ==> Local/Personal environment variables and startup programs # called only during login # ~/.bashrc ==> Anything local/personal and peculiar to the user # # login command programmatically sources /etc/profile and then ONLY # ~/.bash_profile, OR ~/.bash_login, OR ~/.profile in that search order # # logout command programmatically sources ~/.bash_logout # # non-login consoles such as xterm/konsole programmatically sources ~/.bashrc # # /etc/bashrc is not sourced programmatically and must be sourced manually # # local setup: ~/.bash_profile sources ~./bashrc and executes /usr/local/bin/bash_login # ~/.bashrc sources /etc/bashrc # ~/.bash_logout executes /usr/local/bin/bash_logout ##################################################################### # # default bash prompt environment variables ($PS1-$PS4) for non-X consoles are # first defined system-wide in /etc/profile, but redefined (beautified) in /etc/bashrc # bash prompt for xterm/konsole is modified in /etc/bashrc (below), but may be modifed by # users in ~/.bashrc # make any personal changes to the X or non-X console prompts in ~/.bashrc # ##################################################################### # Modify the system-wide shell prompts. The bare-bones prompt is defined initially # in /etc/profile. As this file is sourced by ~/.bashrc, the prompt is redefined and # beautified here. The modified system-wide non-X prompt includes the terminal (tty) # number. The modified system-wide X (console) prompt excludes that information. # First determine our location. This box uses three different Slackware # installations. Modifying the prompt helps the user identify which installation # is being used. Nothing fancy here, just creating an additional variable to # modify the prompt. # Using partition numbers but host names also could be used. # Normal primary boot=/dev/hda10 # Alternate boot=/dev/hda13 # Testing boot=/dev/hda16 ROOT_PARTITION="`mount | grep "on / type"`" # ${VARIABLE:Offset:Count} ROOT_PARTITION=${ROOT_PARTITION:8:2} if [ "$ROOT_PARTITION" = "10" ] || [ "$ROOT_PARTITION" = "23" ]; then PS_MODIFIER="" elif [ "$ROOT_PARTITION" = "13" ] || [ "$ROOT_PARTITION" = "26" ]; then PS_MODIFIER="-alt" elif [ "$ROOT_PARTITION" = "16" ] ; then PS_MODIFIER="-tst" else echo "There was an error trying to configure PS1." fi # now create an appropriate prompt if [ "$TERM" = "xterm" ] || [ "$DISPLAY" != "" ] ; then # inside an X session PS1='[\[\033[01;35m\]\u\[\033[00m\]@\[\033[01;36m\]\h\[\033[01;31m\]$PS_MODIFIER\[\033[00m\]]$ ' # provide a special prompt that is displayed at the top of a terminal window PROMPT_COMMAND='echo -ne "\033]0;${USER}@`uname -n`: ${PWD}\007"' export PROMPT_COMMAND else # not inside an X session so show the tty number PS1='[\[\033[01;35m\]\u\[\033[00m\]@\[\033[01;36m\]\h\[\033[01;31m\]$PS_MODIFIER\[\033[00m\]@\[\033[01;33m\]\l\[\033[00m\]]$ ' fi export PS1 #Set up the LS_COLORS and LS_OPTIONS environment variables for color ls: if [ "$SHELL" = "/bin/zsh" ]; then eval `dircolors -z` elif [ "$SHELL" = "/bin/ash" ]; then eval `dircolors -s` else eval `dircolors -b` fi export LS_OPTIONS="$LS_OPTIONS -l -a" # bash info ENV=$HOME/.bashrc BASH_ENV=$HOME/.bashrc HISTFILE=$HOME/.bash_history HISTFILESIZE=1000 HISTSIZE=1000 HISTCONTROL=ignoreboth export ENV BASH_ENV HISTFILE HISTFILESIZE HISTSIZE HISTCONTROL HOSTTYPE=`uname -m` MACHTYPE=$HOSTTYPE-slackware-`uname -o` export HOSTTYPE MACHTYPE # preferred system-wide console text editor export EDITOR="vim" # --- System-wide aliases --- alias cls="clear" alias copy="cp -i" alias cp="cp -i" alias ifconfig="ifconfig -a" alias lo="logout" alias mc="mc -d" alias md="mkdir" alias mv="mv -i" alias ping="ping -c 3" alias rm="rm -i" alias sd="shutdown -h now" alias vi="vim" alias x="exit" # no longer need the following because of the newer "intelligent" startx script, # but keep for a while for reference sake # alias startx0="startx -- :0 vt7 -dpi 96 -ac -nolisten tcp 2> /dev/null &" # alias startx1="startx -- :1 vt8 -dpi 96 -ac -nolisten tcp 2> /dev/null &" # alias x0="startx0" # alias x1="startx1" # --- Miscellaneous --- # Evaluate terminal size and dynamically resize screen shopt -s checkwinsize