# there is probably a more proper way, but I didn't find any easily on google
unset GNOME_KEYRING_CONTROL
-path_add /a/opt/adt-bundle*/tools /a/opt/adt-bundle*/platform-tools
-
#use extra globing features. See man bash, search extglob.
shopt -s extglob
#include .files when globbing.
shopt -s dotglob
+#but ignore files name . and ..
+#those are default when this is set to anything, so we just set it to one of them
+export GLOBIGNORE=.
-# disabled because it is broken with bash_completion package. It is a known bug they hope to fix.
-# When a glob expands to nothing, make it an empty string instead of the literal characters.
-# shopt -s nullglob
+# broken with bash_completion package. Saw a bug for this once. Don't anymore.
+# still broken in wheezy
+# still buggered in latest stable from the web, version 2.1
+# perhaps its fixed in newer git version, which fails to make for me
+#shopt -s nullglob
# make tab on an empty line do nothing
shopt -s no_empty_cmd_completion
-
# advanced completion
# http://bash-completion.alioth.debian.org/
-# i was using the git version for a while for a bug fix.
-# it's made it into distros now
-# usually this is sourced by the system already,
-# but I check just incase
+# might be sourced by the system already, but I've noticed it not being sourced before
if ! type _init_completion &> /dev/null && [[ -r "/usr/share/bash-completion/bash_completion" ]]; then
. /usr/share/bash-completion/bash_completion
fi
+
# fix spelling errors for cd, only in interactive shell
shopt -s cdspell
# append history instead of overwritting it
export BC_LINE_LENGTH=0
-path_add /a/opt/adt-bundle*/tools /a/opt/adt-bundle*/platform-tools
+path_add --ifexists /a/opt/adt-bundle*/tools /a/opt/adt-bundle*/platform-tools
path_add $HOME/bin/bash-programs-by-ian/utils
# note, if I use a machine I don't want files readable by all users, set
# umask 077 # If fewer than 4 digits are entered, leading zeros are assumed
# --start adds to start of path, which will give it highest priority
# --ifexists will add to path only if the directory exists
path_add() {
- local found x y z
- local ifexists start
+ local found x y z ifexists start loop
ifexists=false
start=false
- while [ "$1" = --* ]; do
- if [ "$1" = --start ]; then
- start=true
- elif [ "$1" = --ifexists ]; then
- ifexists=true
- fi
- shift
+ loop=true
+ # portable substring matching is ugly http://mywiki.wooledge.org/BashFAQ/041
+ while $loop; do
+ case $1 in
+ --*)
+ if [ "$1" = --start ]; then
+ start=true
+ elif [ "$1" = --ifexists ]; then
+ ifexists=true
+ fi
+ shift
+ ;;
+ *)
+ loop=false
+ ;;
+ esac
done
for x in "$@"; do
found=false
done
unset IFS
if ! $found; then
- if ! $ifexists || [ -d $x ]; then
+ if ! $ifexists || [ -d "$x" ]; then
if [ ! "$PATH" ]; then
PATH="$x"
elif $start; then