~ StatC
/.bashrc
My .bashrc with some little functions and aliases and a customized bash prompt
# .bashrc
# Source global definitions
if [ -f /etc/bashrc ]; then
. /etc/bashrc
fi
# User specific aliases and functions
export PATH=~/scripts:$PATH
export CLASSPATH=~/java/packages
export PYTHONPATH=~/py/packages
alias edit='geany'
EDITOR=nano
VISUAL=nano
# --- bash prompt -------------------------------------------------------------
red='\[\e[0;31m\]'
RED='\[\e[1;31m\]'
green='\[\e[0;32m\]'
GREEN='\[\e[1;32m\]'
yellow='\[\e[0;33m\]'
YELLOW='\[\e[1;33m\]'
blue='\[\e[0;34m\]'
BLUE='\[\e[1;34m\]'
cyan='\[\e[0;36m\]'
CYAN='\[\e[1;36m\]'
reset='\[\e[0m\]'
PS1="${red}[\u@\h \W]$ ${reset}"
# --- package management ------------------------------------------------------
# For Debian-based distros
#
# function packFiles() {
# dpkg -L $@
# }
# function packInstall() {
# sudo apt-get install $@
# }
# function packRemove() {
# sudo apt-get autoremove $@
# }
# function packSearch() {
# aptitude search $@
# }
# function packShow() {
# aptitude show $@
# }
# --- var ---------------------------------------------------------------------
function rm() {
echo -n "Really 'rm $@' at '${PWD}'? (type 'yes' to proceed) " 1>&2
read COMMAND
[ "${COMMAND}" == 'yes' ] && /bin/rm "$@"
}
function apacheChmod() {
sudo chown -R apache2:www /var/www
sudo chmod -R 770 /var/www
}
function src-hilite() {
source-highlight $@ --out-format=xhtml |
sed 's%<pre>%<p class="codeSection">%g' |
sed 's%</pre>%</p>%g'
}
function bak() {
convert=0
if test "$1" == '-w'
then
convert=1
shift
fi
for file
do
out="${file}"'-'"$(LANG=ru_RU.UTF8 date '+%x-%X')"
if test ${convert} == 1
then
out=$(echo ${out} | sed 's/:/./g')
fi
cp "${file}" "${out}"
done
}