Removed unnecessary subshell for tty -s check.
[profile.git] / .bash_profile
old mode 100755 (executable)
new mode 100644 (file)
index 35cd3b8..d2f4fc6
@@ -1,52 +1,24 @@
-# $Id$
-for i in ~/.profile.d/*.bashrc; do . $i; done
-__ps1
+if tty -s || [ "${0:0:1}" = "-" -o "$1" = "force" ]; then
+  # Remember if nocaseglob was on.
+  shopt -q nocaseglob
+  nocg=$?
+  # Turn it off so we source stuff in the right order.
+  shopt -u nocaseglob
 
-unset XMODIFIERS #:-(
-export SSHTERM="urxvt"
-export SSHTERM_TITLE="-title"
-export SSHTERM_EXEC="-e"
+  # Remember LC_ALL.
+  lc_all=$LC_ALL
+  # Turn it off to set case-sensitive matching
+  LC_ALL=C
 
-if [ "$OSTYPE" = "cygwin" ]; then
-  shopt -s nocaseglob
-fi
-
-#[ "$TERM" = "xterm-color" ] && export TERM=xterm-xfree86
-export PATH=~/bin:"$PATH"
+  # Source all scripts.
+  for i in ${PROFILE_HOME:-~}/.profile.d/*.bashrc; do . "$i"; done; unset i
 
-function upload() {
-  if [ $# = 0 ]; then
-    echo usage: upload file [file...]
-    return 100
-  fi
-  pwd=$PWD/
-  pwd=${pwd##/home/iain/www/}
-  if echo $pwd | grep -q ^/; then
-    echo not rooted under /home/iain/www
-    unset pwd
-    return 111
-  fi
-# scp ${1+"$@"} 64.176.170.109:/home/iain/$pwd
-  lftp -c "open web1.viagold.net; cd $pwd; mput $@"
-  unset pwd
-}
+  # Maybe turn nocaseglob back on.
+  [ $nocg = 0 ] && shopt -s nocaseglob
 
-function download() {
-  if [ $# = 0 ]; then
-    echo usage: download file [file...]
-    return 100
-  fi
-  pwd=$PWD/
-  pwd=${pwd##/home/iain/www/}
-  if echo $pwd | grep -q ^/; then
-    echo not rooted under /home/iain/www
-    unset pwd
-    return 111
-  fi
-# scp ${1+"$@"} 64.176.170.109:/home/iain/$pwd
-  lftp -c "open web1.viagold.net; cd $pwd; mget $@"
-  unset pwd
-}
-alias debug='valgrind --leak-check=yes --show-reachable=yes --num-callers=5 --verbose'
+  # Reset LC_ALL.
+  LC_ALL=$lc_all
 
-eval `dircolors -b`
+  unset lc_all nocg
+  __ps1
+fi