# (c) Copyright 2000-2005, Andrew@DeFaria.com, all rights reserved.
#
################################################################################
+# The following will set HOME, temporarily, to the directory of my $HOME so that
+# somebody other than me can envoke my startup scripts. I use this mainly for
+# when I become root with sudo -s and what a better environment that the bare
+# bones root environment gives you. Note that for us to be effective one must
+# source (or .) this file and if so the ${BASH_ARGV[0]} is the normal $0
+home=$(dirname ${BASH_ARGV[0]})
+
+# Strip off .rc
+home=${home/%\/\.rc/}
+
+# Now set $HOME if $home is different.
+saved_home=$HOME
+if [ "$HOME" != "$home" ]; then
+ HOME=$home
+fi
+
# Set ARCHITECTURE of the machine
KERNEL=$(uname -s)
if [[ $KERNEL = CYGWIN* ]]; then
# Set display to local
export DISPLAY=${DISPLAY:-:0}
+# Reset home in case it changed
+HOME=$saved_home
+
# Now go home (in case we were not autmatically cd'ed there)
if [ $(id -u) -ne 0 ]; then
cd
# Function to set the title bar. Works on the terminal emulators listed.
function title_bar {
+ if [ $# -gt 1 ]; then
+ ROOT=shift
+ ROOT="${NORMAL}\($ROOT\)"
+ fi
+
prefix="$@"
+
# Change $HOME -> ~
if [ "${PWD#$HOME*}" != "$PWD" ]; then
current_dir="~${PWD#$HOME*}"
string=$(echo "${SYSNAME##*:}:$@")
echo -n "${ESC}]2;$string\007"
elif [ "$TERM" = "cygwin" -o "$TERM" = "vt100" -o "$TERM" = "xterm" ]; then
- PS1="\[\e]0;$prefix$current_dir\a\e[01;33m\]$SYSNAME:\[\e[0m\]"
+ PS1="\[\e]0;$prefix$current_dir\a$ROOT\e[01;33m\]$SYSNAME:\[\e[0m\]"
fi
} # title_bar
view_name=""
title_bar "$ROOT"
else
- title_bar "${ROOT}View: $view_name: "
+ title_bar "$ROOT" "View: $view_name: "
fi
icon_name "${SYSNAME##*:}"