summaryrefslogtreecommitdiff
path: root/bashrc
blob: b887463398d2e3d7477b82d092d32c15d3f594d1 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
# ~/.bashrc: executed by bash(1) for non-login shells.
# see /usr/share/doc/bash/examples/startup-files for examples

# If running interactively, then:
if [ "$PS1" ]; then
	typeset HISTCONTROL=ignoreboth
	typeset HISTSIZE=5000

	CVS_RSH=ssh
	RSYNC_RSH=ssh

	CVSROOT=weasel@cvs.noreply.org:/var/cvs/debian
	CVSDEB_ROOTDIR=$HOME/projects/debian/Packages
	DEBEMAIL="weasel@debian.org"

	export CVS_RSH CVSROOT CVSDEB_ROOTDIR DEBEMAIL RSYNC_RSH
	
	# malsync
	PILOTRATE=115200
	alias malsync='malsync -p proxy -r 3128'
	export PILOTRATE

	if [ `uname` = "Linux" ];
	then
			export LS_OPTIONS='-F --color=auto'
			which dircolors > /dev/null && eval `dircolors`

			alias grep='grep --color'
	fi
	
	alias ls='ls $LS_OPTIONS'
	alias ll='ls $LS_OPTIONS -l'
	alias la='ls $LS_OPTIONS -la'
	alias l='ls $LS_OPTIONS -l'

	alias cp='cp -i'
	alias mv='mv -i'

	alias ..='cd ..'

	if [ -x /usr/bin/recode ]; then
		alias unix2dos='recode lat1:ibmpc'
		alias dos2unix='recode ibmpc:lat1'
	fi

	alias 221='pstops "2:0L@.7(21cm,0)+1L@.7(21cm,14.85cm)"'
	alias rot13='tr a-zA-Z n-za-mN-ZA-M'
	alias xlock='ssh-add -D && xlock -mode blank'

	if [ `hostname` = 'helium' ]; then
		alias 'apt-get'='aptitude'
	fi

	if [ -f ~/.ssh/config ] ; then
		for i in `grep "^Host " ~/.ssh/config | awk ' !/\*/ {print $2}'`; do alias $i="ssh $i"; done
	fi

	which ddate > /dev/null && ddate
	echo
	if [ -x /usr/games/fortune ]; then
		FPATH=""
		[ -d /usr/share/games/fortunes ] && FPATH="$FPATH /usr/share/games/fortunes"
		[ -d /usr/share/games/fortunes/off ] && FPATH="$FPATH /usr/share/games/fortunes/off"
		[ -d $HOME/.fortunes/ ] && FPATH="$FPATH $HOME/.fortunes/"
		fortune $FPATH
		echo
	fi;
	
	if [ "`id -u`" = "0" ] ; then
		PS1='\h:\w\$ '
		alias ro='mount -o remount,ro'
		alias rw='mount -o remount,rw'

		PATH=/sbin:/usr/sbin:$PATH
		export PATH
	else
		PS1='\u@\h:\w\$ '
	fi;

	ROLE=`id | sed -n 's/.* context=\([^ ]*\) .*/\1/p'`
	if [ -n "$ROLE" ]; then
		PS1="[$ROLE] \\h:\\w\\\$ "
	fi
	if [ -e /etc/debian_chroot ]; then
		debian_chroot=$(cat /etc/debian_chroot)
		PS1="[$debian_chroot] $PS1"
	fi

	case $TERM in
		xterm*)
			if [ "`id -u`" != "0" ] ; then
				PROMPT_COMMAND='PRINTPWD=`echo ${PWD} | sed "s,${HOME},~,"`;
					echo -ne "\033]0;${USER}@${HOSTNAME}: ${PRINTPWD}\007";'
			else
				PROMPT_COMMAND='echo -ne "\033]0;${HOSTNAME}# ${PWD}\007";'
			fi
			;;
		*)
			;;
	esac
	
	if [ -d /usr/lib/ccache ] ; then
		PATH="/usr/lib/ccache:${PATH}"
	elif [ -d /usr/lib/compilercache ] ; then
		PATH="/usr/lib/compilercache:${PATH}"
	fi

	## Export environment
	if [ -x /usr/bin/lesspipe ] ; then
		eval `lesspipe`
	fi

fi

# vim:set ts=4: