# ---- Test interactive shell ---- # [ -z "$PS1" ] && return if [[ $- != *i* ]] ; then return fi # ---- source base ---- # if [ -f /etc/bashrc ]; then . /etc/bashrc fi # ---- bash completion ---- # if [ -f /etc/bash_completion ]; then . /etc/bash_completion fi # ---- Paths ---- # export CUDA_SDK_ROOT="/home/anjul/sw/CUDA2.3" export LD_LIBRARY_PATH="$LD_LIBRARY_PATH:/usr/local/cuda/lib" export PATH="$PATH:/usr/local/cuda/bin:/home/anjul/sw/smallk" # ---- Aliases ---- # # enable color support of ls and also add handy aliases if [ "$TERM" != "dumb" ]; then eval "`dircolors -b`" alias ls='ls --color=auto' alias mv='mv -i' alias spi='spim -file ' alias dir='ls --color=auto --format=vertical' alias vdir='ls --color=auto --format=long' fi alias ll='ls -hl' alias la='ls -A' alias l='ls -CF' alias ssh='ssh -X' alias rm='rm -i' alias cp='cp -i' alias mv='mv -i' alias mkdir='mkdir -p' alias lmk='latexmk -pdfps -pv' # ---- Functions ---- # function repeat() # Repeat n times command. { local i max max=$1; shift; for ((i=1; i <= max ; i++)); do # --> C-like syntax eval "$@"; done } # ---- Set prompt ---- # function setprompt { local black="\[\033[0;30m\]" local grey="\[\033[1;30m\]" local blue="\[\033[0;34m\]" local lightBlue="\[\033[1;34m\]" local green="\[\033[0;32m\]" local lightGreen="\[\033[1;32m\]" local cyan="\[\033[0;36m\]" local lightCyan="\[\033[1;36m\]" local red="\[\033[0;31m\]" local lightRed="\[\033[1;31m\]" local purple="\[\033[0;35m\]" local lightPurple="\[\033[1;35m\]" local brown="\[\033[0;33m\]" local yellow="\[\033[1;33m\]" local lightGrey="\[\033[0;37m\]" local white="\[\033[1;37m\]" local none="\[\033[0m\]" # Check the script is being run by root if [ "$(id -u)" != "0" ]; then local SYMBOL="$" local UNAME_COLOR=$lightBlue local SYMBOL_COLOR=$blue else local SYMBOL="#" local UNAME_COLOR=$red local SYMBOL_COLOR=$red fi #Custom PS1 string (prompt) PS1="$grey[$green$(date +%H):$(date +%M)$grey][$UNAME_COLOR\u$grey@$purple\h$grey]$grey\W$SYMBOL_COLOR$SYMBOL$none " #export PS1; } setprompt