# This is my highly customized .bashrc # // Henrik Kjellander # # Note: there's a reason to use $HOME instead of ~ since ~ won't work on a # remote computer if it hasn't got the same directory structure. # (for example the ssh remote things) # # Setup, this is all you should need to change: # your common login name to other servers USER=henrik # your personal laptop's hostname (used to check which computer this .bashrc # is running at when setting up MTA) MY_HOST=exton ############# ALIASES ####################### # colors makes life easier! alias ls='ls --color=auto' alias ll='ls -la --color=auto' alias l='ls -l --color=auto' # easier to read free disk space: alias dh='df -h' # grep with filenames and row numbers printed always alias grep='grep -nI' # top udating every second alias top='top -d 1' # repair broken svn database on grandchallenge alias recover='svnadmin recover /dgc/subversion/dgc; chmod g+w /dgc/subversion/dgc/db/*' # turn on/off profiling for multithreaded applications alias profon='export LD_PRELOAD=$HOME/dgc/local/gprof-helper.so' alias profoff='export LD_PRELOAD=' # SSH # always use encryption alias ssh='ssh -X' alias gc='ssh $USER@grandchallenge.caltech.edu' alias co='ssh $USER@co' alias ti='ssh $USER@ti' alias ta='ssh $USER@ta' alias mg='ssh $USER@mg' alias ir='ssh $USER@ir' alias os='ssh $USER@os' # for navigation alias s='cd ..' export ARB=$HOME/dgc/bob/RaceModules/Arbiter2 export COR=$HOME/dgc/bob/RaceModules/CorridorArcEvaluator export FUS=$HOME/dgc/bob/DevModules/FusionMapper export GEN=$HOME/dgc/bob/RaceModules/Arbiter2/GeneticAlgorithm export GLO=$HOME/dgc/bob/RaceModules/GlobalPlanner export LAD=$HOME/dgc/bob/RaceModules/LADARMapper export LOG=$HOME/dgc/bob/DevModules/LogPlayer export MAT=$HOME/dgc/bob/DevModules/MatlabDisplay export MOD=$HOME/dgc/gazebo/models export RDDF=$HOME/dgc/bob/RDDF export STE=$HOME/dgc/bob/DevModules/StereoMapper export PLA=$HOME/dgc/bob/DevModules/PlayerInterface export SKY=$HOME/dgc/projects/SkyNetGUI export VOT=$HOME/dgc/bob/RaceModules/Arbiter2/VoterSim export WOR=$HOME/dgc/gazebo/worlds # gazebo quick startup alias gz='cd ~/dgc/gazebo/worlds; gazebo tahoe_demo.world' alias pl='cd ~/dgc/gazebo/config; player -g default gazebo_cvs.cfg' alias plv='playerv --laser:0 --position:0' ################### EXPORTS ################################# # don't remember why export CPATH=$CPATH:/usr/local/include # Set up some useful paths for scripts and binaries export PATH=$PATH:/sbin:/usr/sbin:/usr/local/bin:/opt/gnome/bin:$HOME/dgc/local/scripts # some more for Java export PATH=$PATH:/usr/lib/java/bin:/usr/lib/java/jre/bin # to be able compiling the svn tree export PATH=$PATH:$HOME/dgc/bin:$HOME/dgc/bob/bin # SVN editor export SVN_EDITOR=vim #---------- Set up MTA ------------ # MTA home, for the ip and grid files export MTAHOME=$HOME/local # the race computers we want to configure # NOTE: you need the short aliases in your /etc/hosts file to use this. RACE_COMPUTERS="co ti ta mg ir os" # If my laptop, set up so I have the same ip and grid files as the race # computers, plus my own IP # NOTE: for the first time you have to create these files manually in # your ~/local dir (copy them from race computers /etc and edit). if [ "$HOSTNAME" == "$MY_HOST" ]; then # Check if we have got a new IP than last time (through DHCP for example) # Observe the following line only works if you have my grep alias (grep -n) # and that if the NIC you wish to use for MTA communication is eth0. # You must also have ifconfig in your PATH (see above in this .bashrc). NEW_IP=$(ifconfig eth0 | grep "inet addr" | awk -F : {'print $3'} | awk {'print $1'}) OLD_IP=$(cat $HOME/local/ip) # If the new ip is not empty (like when we're not connected) # or the ip has changed compared to the old one, update the ip file if [[ $NEW_IP && "$NEW_IP" != "$OLD_IP" ]]; then echo $NEW_IP > $HOME/local/ip # Distribute my current ip to the race computers, so they can talk to me: # NOTE: this requires dgc/local/scripts/distribute_sshkeys.sh to be run # first to avoid you having to type password all the time! for comp in $RACE_COMPUTERS do scp $HOME/local/ip henrik@$comp:local/ip_henrik done fi # end of ip changed # Set up my local Matlab dir export MATLAB_ROOT=/opt/Matlab14 else if [ "$HOSTNAME" != "grandchallenge.caltech.edu" ]; then # On race computers (actually all other computers except grandchallenge): # Copy the ip and grid files to my local dir if test -e "/etc/ip" && test -e "/etc/grid"; then mkdir -p $HOME/local cp /etc/ip $HOME/local/ cp /etc/grid $HOME/local/ # Add my laptop's ip to their grid file # NOTE: for this to work the file must have an endline after the last row echo -n "henrik " >> ~/local/grid cat $HOME/local/ip_henrik >> $HOME/local/grid echo "" >> ~/local/grid # endline at the end fi fi # Matlab dir on grandchallenge and race computers export MATLAB_ROOT=/usr/local/matlab6p5 fi ########################################################################### # Set my prompt. It diplays user@computer # Set the prompt's color to: # - blue if I'm on my laptop # - green if I'm on a remote computer (except grandchallenge) # - red if I'm on grandchallenge if [ "$HOSTNAME" == "grandchallenge.caltech.edu" ]; then PS1_COLOR="31;1" else if [ "$HOSTNAME" == "exton" ]; then PS1_COLOR="34;1" else PS1_COLOR="32;1" fi fi # if I'm root, add underscore to the prompt as a reminder if [ ${UID} -eq 0 ]; then PS1_COLOR="4;$PS1_COLOR" fi # Set the colored prompt: PS1="\[\e["$PS1_COLOR"m\]\u@\h:\w$\[\e[0m\] "