Browse files

spaces in directory names are evil

especially when used with variables that are not quoted.
  • Loading branch information...
1 parent 2a7f2f2 commit 0fdde086eab57222214eb077655c269bda5f7ca5 @px committed Oct 9, 2011
Showing with 83 additions and 86 deletions.
  1. +5 −5 common/git.sh
  2. +11 −11 desktop.sh
  3. +13 −13 mb-koobcam.sh
  4. +17 −19 server-px.sh
  5. +9 −10 server.sh
  6. +15 −13 sourcing
  7. +13 −15 win32-desktop.sh
View
10 common/git.sh
@@ -1,11 +1,11 @@
#!/bin/echo "This file is meant to be sourced from the command or .bashrc"
-dir=`dirname $BASH_SOURCE`
-_dir=$dir
+dir=`dirname "$BASH_SOURCE"`
+_dir="$dir"
-zour $dir/bash-completion/git-completion.sh
-zour $dir/git-shortcuts.sh
+zour "$dir/bash-completion/git-completion.sh"
+zour "$dir/git-shortcuts.sh"
##export PS1="\[\033[0;33m\]\$(__git_ps1 '%s ')\[\033[00m\]$PS1"
-dir=$_dir
+dir="$_dir"
View
22 desktop.sh
@@ -1,23 +1,23 @@
#!/bin/echo "This file is meant to be sourced from the command or .bashrc"
# Usage:
-# echo ". ~/.bash/desktop.sh" >> ~/.bash_login
+# echo "zour ~/.bash/desktop.sh" >> ~/.bash_login
-dir=`dirname $BASH_SOURCE`
+dir=`dirname "$BASH_SOURCE"`
-. $dir/common/terminal.sh
+zour "$dir/common/terminal.sh"
export PS1='\[\033[0;37m\]\w\[\033[00m\] \$ ' # override PS1 to a simpler format
-. $dir/common/path.sh
-. $dir/common/misc-env.sh
-. $dir/common/misc-shortcuts.sh
-. $dir/common/git.sh
+zour "$dir/common/path.sh"
+zour "$dir/common/misc-env.sh"
+zour "$dir/common/misc-shortcuts.sh"
+zour "$dir/common/git.sh"
-. $dir/desktop/path.sh
-. $dir/desktop/misc-env.sh
-. $dir/desktop/editors.sh
-. $dir/desktop/work.sh
+zour "$dir/desktop/path.sh"
+zour "$dir/desktop/misc-env.sh"
+zour "$dir/desktop/editors.sh"
+zour "$dir/desktop/work.sh"
View
26 mb-koobcam.sh
@@ -5,9 +5,9 @@ if [[ -n "$DOTBASH_DEBUG" ]] ; then echo "mb-koobcam.sh imported"; fi
# Usage:
# echo ". ~/.bash/mb-koobcam.sh" >> ~/.bash_login
-dir=`dirname $BASH_SOURCE`
+dir=`dirname "$BASH_SOURCE"`
-zour $dir/common/terminal.sh
+zour "$dir/common/terminal.sh"
#export PS1='\[\033[0;37m\]\w\[\033[00m\] \$ ' # override PS1 to a simpler format
# default
@@ -16,20 +16,20 @@ zour $dir/common/terminal.sh
export PS1='\[\033[01;33m\]\u@\h\[\033[01;31m\] \w \[\033[01;34m\]\$\[\033[00m\] '
#export PS1="\[\e[0;31m\]\u@\h:\w\$ \[\e[1;30m\]"
-zour $dir/common/path.sh
-zour $dir/common/misc-env.sh
-zour $dir/common/misc-shortcuts.sh
-zour $dir/common/x11.sh
+zour "$dir/common/path.sh"
+zour "$dir/common/misc-env.sh"
+zour "$dir/common/misc-shortcuts.sh"
+zour "$dir/common/x11.sh"
-zour $dir/desktop/path.sh
-zour $dir/desktop/misc-env.sh
-zour $dir/desktop/editors.sh
-zour $dir/desktop/work.sh
+zour "$dir/desktop/path.sh"
+zour "$dir/desktop/misc-env.sh"
+zour "$dir/desktop/editors.sh"
+zour "$dir/desktop/work.sh"
-zour $dir/common/git.sh
-zour $dir/mac.sh
+zour "$dir/common/git.sh"
+zour "$dir/mac.sh"
-zour $dir/common/android-dev.sh
+zour "$dir/common/android-dev.sh"
alias rc='cd ~/.bash; $EDITOR ; source ~/.bash_login'
alias f5='source ~/.bash_login'
View
36 server-px.sh
@@ -1,33 +1,31 @@
#!/bin/echo "This file is meant to be sourced from the command or .bashrc"\
-# Usage:
-# echo "zour ~/.bash/server.sh" >> ~/.bash_login
## default PS1 on gentoo
export PS1='\[\033[01;32m\]\u@\h\[\033[01;34m\] \w \$\[\033[00m\] '
-dir=`dirname $BASH_SOURCE`
+dir=`dirname "$BASH_SOURCE"`
-zour $dir/common/terminal.sh
-zour $dir/common/path.sh
-zour $dir/common/misc-env.sh
-zour $dir/common/misc-shortcuts.sh
-zour $dir/common/ssh.sh
-zour $dir/common/x11.sh
+zour "$dir/common/terminal.sh"
+zour "$dir/common/path.sh"
+zour "$dir/common/misc-env.sh"
+zour "$dir/common/misc-shortcuts.sh"
+zour "$dir/common/ssh.sh"
+zour "$dir/common/x11.sh"
-zour $dir/common/linux.sh
-zour $dir/common/lvm.sh
-zour $dir/common/md.sh
+zour "$dir/common/linux.sh"
+zour "$dir/common/lvm.sh"
+zour "$dir/common/md.sh"
-zour $dir/common/gentoo.sh
-zour $dir/common/ftp.sh
+zour "$dir/common/gentoo.sh"
+zour "$dir/common/ftp.sh"
-zour $dir/server/range.sh
-zour $dir/server/misc.sh
+zour "$dir/server/range.sh"
+zour "$dir/server/misc.sh"
-zour $dir/server/editors.sh
-zour $dir/server/ejabber.sh
+zour "$dir/server/editors.sh"
+zour "$dir/server/ejabber.sh"
-zour $dir/common/git.sh
+zour "$dir/common/git.sh"
#test -r /sw/bin/init.sh && zour /sw/bin/init.sh
View
19 server.sh
@@ -1,17 +1,16 @@
#!/bin/echo "This file is meant to be sourced from the command or .bashrc"
# Usage:
-# echo ". ~/.bash/server.sh" >> ~/.bash_login
+# echo "zour ~/.bash/server.sh" >> ~/.bash_login
-dir=`dirname $BASH_SOURCE`
+dir=`dirname "$BASH_SOURCE"`
-. $dir/common/terminal.sh
-. $dir/common/path.sh
-. $dir/common/misc-env.sh
-. $dir/common/misc-shortcuts.sh
+zour "$dir/common/terminal.sh"
+zour "$dir/common/path.sh"
+zour "$dir/common/misc-env.sh"
+zour "$dir/common/misc-shortcuts.sh"
-. $dir/server/range.sh
-. $dir/server/misc.sh
+zour "$dir/server/range.sh"
+zour "$dir/server/misc.sh"
-. $dir/common/git.sh
+zour "$dir/common/git.sh"
-test -r /sw/bin/init.sh && . /sw/bin/init.sh
View
28 sourcing
@@ -9,7 +9,7 @@ HEADER1
### for false just leave empty, true is any value.
-export DOTBASH_DEBUG=
+export DOTBASH_DEBUG=true
export DOTBASH_DTIMER=
## set our local host name (eg. everything before the first period.)
@@ -20,8 +20,8 @@ export mySystem=$(uname -s)
#readonly myName
readonly mySystem
-dir=`dirname $BASH_SOURCE`
-_dir=$dir
+dir=`dirname "$BASH_SOURCE"`
+_dir="$dir"
alias eecho="echo"
alias eecho="echo \>\>\> "
@@ -38,14 +38,14 @@ echo the file name
ZOUR_HELP1
function zour {
- if [[ -f $1 ]]; then
- eecho "file: $1"
+ if [[ -f "$@" ]]; then
+ eecho "file: \"$@\""
if [[ -z "$DOTBASH_DTIMER" ]] ; then
- . $@
+ . "$@"
else
echo "Timer results below:"
- time . $@
+ time . "$@"
echo; echo
fi
fi
@@ -62,8 +62,8 @@ if [[ $mySystem == "Darwin" ]]; then
## use this system name based on the configured name not DNS
myName=`/usr/libexec/PlistBuddy -c 'Print System:Network:HostNames:LocalHostName' /Library/Preferences/SystemConfiguration/preferences.plist`
- zour $_dir/mb-$myName.sh
- zour $_dir/mbp-$myName.sh
+ zour "$_dir/mb-$myName.sh"
+ zour "$_dir/mbp-$myName.sh"
## other options for hostname determination
### /usr/libexec/PlistBuddy -c 'Print System:Network:HostNames:LocalHostName' \
@@ -79,15 +79,17 @@ fi
if [[ $mySystem == "Linux" ]]; then
eecho "System: Linux"
## if my ~/.bash/server-$HOSTNAME file exists
- zour $_dir/server-$myName.sh
+ zour "$_dir/server-$myName.sh"
fi
###
### MING on Windows
-if [[ $mySystem == "MINGW32_NT-6.1" ]] ; then
+#if [[ $mySystem =~ /MINGW32_NT/ ]] ; then
+if [[ $(echo $mySystem | grep MINGW32_NT) ]] ; then
eecho "System: MINGW32"
- zour $_dir/win32-$myName.sh
- zour $_dir/win32-desktop.sh
+
+ zour "$_dir/win32-desktop.sh"
+ zour "$_dir/win32-$myName.sh"
fi
###
View
28 win32-desktop.sh
@@ -1,10 +1,8 @@
#!/bin/echo "This file is meant to be sourced"
-# Usage:
-# echo ". ~/.bash/mb-koobcam.sh" >> ~/.bash_login
-dir=`dirname $BASH_SOURCE`
+dir=`dirname "$BASH_SOURCE"`
-#. $dir/common/terminal.sh
+#zour $dir/common/terminal.sh
#export PS1='\[\033[0;37m\]\w\[\033[00m\] \$ ' # override PS1 to a simpler format
# default
@@ -13,20 +11,20 @@ dir=`dirname $BASH_SOURCE`
#export PS1='\[\033[01;33m\]\u@\h\[\033[01;31m\] \w \[\033[01;34m\]\$\[\033[00m\] '
#export PS1="\[\e[0;31m\]\u@\h:\w\$ \[\e[1;30m\]"
-#. $dir/common/path.sh
-#. $dir/common/misc-env.sh
-. $dir/common/misc-shortcuts.sh
-#. $dir/common/x11.sh
+#zour "$dir/common/path.sh"
+#zour "$dir/common/misc-env.sh"
+zour "$dir/common/misc-shortcuts.sh"
+#zour "$dir/common/x11.sh"
-#. $dir/desktop/path.sh
-. $dir/desktop/misc-env.sh
-. $dir/desktop/editors.sh
-. $dir/desktop/work.sh
+#zour "$dir/desktop/path.sh"
+zour "$dir/desktop/misc-env.sh"
+zour "$dir/desktop/editors.sh"
+zour "$dir/desktop/work.sh"
-. $dir/common/git.sh
-. $dir/common/win32.sh
+zour "$dir/common/git.sh"
+zour "$dir/common/win32.sh"
-#. $dir/common/android-dev.sh
+#zour "$dir/common/android-dev.sh"
alias rc='cd ~/.bash; $EDITOR ; source ~/.bash_login'
alias f5='source ~/.bash_login'

0 comments on commit 0fdde08

Please sign in to comment.