Harmonizing the bash startup scripts
Posted: 16. Aug 2010, 20:19
I noticed certain things about Salix (the coloring scheme in the boot sequence, for example) that I'd learned from Darrell Anderson's Slackware guide. The most useful part is, IMHO, the part about bash startup scripts and how you can 'harmonize' your shell environment. Why not include a similar set of scripts in /etc/skel for the next Salix release?
I added a few useful statements from Debian to make these:
Small things that make the difference - colorized grep output, vim and most as default pager and editor, all very well commented to make life easier for the terminal newbie 
I added a few useful statements from Debian to make these:
Code: Select all
# /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 bash_login
# ~/.bashrc sources /etc/bashrc
# ~/.bash_logout executes bash_logout
#
#####################################################################
PS1='[\u@\h \W]\$ '
. /etc/profile.d/bash_completion.sh
. /etc/profile.d/coreutils-dircolors.sh
# Needed to get "man" to work properly in Unicode locales:
alias man='LC_ALL=C man'
# Some more alias to avoid making mistakes:
alias rm='rm -i'
alias cp='cp -i'
alias mv='mv -i'
# Evaluate terminal size and dynamically resize screen
shopt -s checkwinsize
# Don't put duplicate lines in the history:
export HISTCONTROL=ignoredups
# Colorized grep output and man pages:
export PAGER='most'
export GREP_OPTIONS='--color=auto'
export GREP_COLOR='1;31'
# Set Vi IMproved as the default editor:
export EDITOR='vim'
Code: Select all
# ~/.bashrc
#
# see /etc/bashrc for a complete description how all bash source files
# are related and used on this box
# Source system-wide aliases and functions
if [ -f /etc/bashrc ]; then
source /etc/bashrc
fi
# --- Local/Personal environment variables ---
# define bash prompts, non-X text editors, etc.
unset MAILCHECK
# --- Local aliases ---
# --- Local functions ---
Code: Select all
# ~/.bash_login
#
# see /etc/bashrc for a complete description how all bash source files
# are related and used on this box
# Source Local/Personal aliases and functions
if [ -f $HOME/.bashrc ]; then
source $HOME/.bashrc
fi
# Source /usr/local/bin/bash_login
if [ -x /usr/local/bin/bash_login ]; then
/usr/local/bin/bash_login
fi
# --- Local/Personal startup programs ---
Code: Select all
# ~/.bash_logout
#
# see /etc/bashrc for a complete description how all bash source files
# are related and used on this box
# Source /usr/local/bin/bash_logout
if [ -x /usr/local/bin/bash_logout ]; then
/usr/local/bin/bash_logout
fi
clear
