Skip to content

Commit

Permalink
fixes Bash-it#343 by surrounding $HOME (which can have spaces) with q…
Browse files Browse the repository at this point in the history
…uotations marks
  • Loading branch information
Benjamin Brombach committed Apr 29, 2015
1 parent d0d6780 commit 4510c9e
Show file tree
Hide file tree
Showing 13 changed files with 23 additions and 23 deletions.
4 changes: 2 additions & 2 deletions bash_it.sh
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ PREVIEW="less"

# Load all the Jekyll stuff

if [ -e $HOME/.jekyllconfig ]
if [ -e "$HOME/.jekyllconfig" ]
then
. $HOME/.jekyllconfig
. "$HOME/.jekyllconfig"
fi
2 changes: 1 addition & 1 deletion completion/available/dirs.completion.bash
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ _dirs-complete() {
local CURRENT_PROMPT="${COMP_WORDS[COMP_CWORD]}"

# parse all defined shortcuts from ~/.dirs
if [ -r $HOME/.dirs ]; then
if [ -r "$HOME/.dirs" ]; then
COMPREPLY=($(compgen -W "$(grep -v '^#' ~/.dirs | sed -e 's/\(.*\)=.*/\1/')" -- ${CURRENT_PROMPT}) )
fi

Expand Down
10 changes: 5 additions & 5 deletions completion/available/ssh.completion.bash
Original file line number Diff line number Diff line change
Expand Up @@ -13,14 +13,14 @@ _sshcomplete() {


# parse all defined hosts from .ssh/config
if [ -r $HOME/.ssh/config ]; then
COMPREPLY=($(compgen -W "$(grep ^Host $HOME/.ssh/config | awk '{print $2}' )" ${OPTIONS}) )
if [ -r "$HOME/.ssh/config" ]; then
COMPREPLY=($(compgen -W "$(grep ^Host "$HOME/.ssh/config" | awk '{print $2}' )" ${OPTIONS}) )
fi

# parse all hosts found in .ssh/known_hosts
if [ -r $HOME/.ssh/known_hosts ]; then
if grep -v -q -e '^ ssh-rsa' $HOME/.ssh/known_hosts ; then
COMPREPLY=( ${COMPREPLY[@]} $(compgen -W "$( awk '{print $1}' $HOME/.ssh/known_hosts | cut -d, -f 1 | sed -e 's/\[//g' | sed -e 's/\]//g' | cut -d: -f1 | grep -v ssh-rsa)" ${OPTIONS}) )
if [ -r "$HOME/.ssh/known_hosts" ]; then
if grep -v -q -e '^ ssh-rsa' "$HOME/.ssh/known_hosts" ; then
COMPREPLY=( ${COMPREPLY[@]} $(compgen -W "$( awk '{print $1}' "$HOME/.ssh/known_hosts" | cut -d, -f 1 | sed -e 's/\[//g' | sed -e 's/\]//g' | cut -d: -f1 | grep -v ssh-rsa)" ${OPTIONS}) )
fi
fi

Expand Down
2 changes: 1 addition & 1 deletion completion/available/todo.completion.bash
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ _todo()
mv prepend prep pri p replace report"

# Add custom commands from add-ons, if installed.
COMMANDS="$COMMANDS $('ls' ${TODO_ACTIONS_DIR:-$HOME/.todo.actions.d}/ 2>/dev/null)"
COMMANDS="$COMMANDS $('ls' ${TODO_ACTIONS_DIR:-"$HOME/.todo.actions.d"}/ 2>/dev/null)"

OPTS="-@ -@@ -+ -++ -d -f -h -p -P -PP -a -n -t -v -vv -V -x"

Expand Down
4 changes: 2 additions & 2 deletions completion/available/vagrant.completion.bash
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ _vagrant() {
then
case "$prev" in
"init")
local box_list=$(find $HOME/.vagrant.d/boxes -mindepth 1 -maxdepth 1 -type d -exec basename {} \;|sed -e 's/-VAGRANTSLASH-/\//')
local box_list=$(find "$HOME/.vagrant.d/boxes" -mindepth 1 -maxdepth 1 -type d -exec basename {} \;|sed -e 's/-VAGRANTSLASH-/\//')
COMPREPLY=($(compgen -W "${box_list}" -- ${cur}))
return 0
;;
Expand Down Expand Up @@ -127,7 +127,7 @@ _vagrant() {
"box")
case "$prev" in
"remove"|"repackage")
local box_list=$(find $HOME/.vagrant.d/boxes -mindepth 1 -maxdepth 1 -type d -exec basename {} \;|sed -e 's/-VAGRANTSLASH-/\//')
local box_list=$(find "$HOME/.vagrant.d/boxes" -mindepth 1 -maxdepth 1 -type d -exec basename {} \;|sed -e 's/-VAGRANTSLASH-/\//')
COMPREPLY=($(compgen -W "${box_list}" -- ${cur}))
return 0
;;
Expand Down
10 changes: 5 additions & 5 deletions install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ esac

BACKUP_FILE=$CONFIG_FILE.bak

if [ -e $HOME/$BACKUP_FILE ]; then
if [ -e "$HOME/$BACKUP_FILE" ]; then
echo "Backup file already exists. Make sure to backup your .bashrc before running this installation." >&2
while true
do
Expand All @@ -32,11 +32,11 @@ if [ -e $HOME/$BACKUP_FILE ]; then
done
fi

test -w $HOME/$CONFIG_FILE &&
cp -a $HOME/$CONFIG_FILE $HOME/$CONFIG_FILE.bak &&
test -w "$HOME/$CONFIG_FILE" &&
cp -a "$HOME/$CONFIG_FILE" "$HOME/$CONFIG_FILE.bak" &&
echo "Your original $CONFIG_FILE has been backed up to $CONFIG_FILE.bak"

cp $HOME/.bash_it/template/bash_profile.template.bash $HOME/$CONFIG_FILE
cp "$HOME/.bash_it/template/bash_profile.template.bash" "$HOME/$CONFIG_FILE"

echo "Copied the template $CONFIG_FILE into ~/$CONFIG_FILE, edit this file to customize bash-it"

Expand Down Expand Up @@ -95,7 +95,7 @@ else
read -e -n 1 -p "Do you use Jekyll? (If you don't know what Jekyll is, answer 'n') [y/N] " RESP
case $RESP in
[yY])
cp $HOME/.bash_it/template/jekyllconfig.template.bash $HOME/.jekyllconfig
cp "$HOME/.bash_it/template/jekyllconfig.template.bash" "$HOME/.jekyllconfig"
echo "Copied the template .jekyllconfig into your home directory. Edit this file to customize bash-it for using the Jekyll plugins"
break
;;
Expand Down
2 changes: 1 addition & 1 deletion plugins/available/nvm.plugin.bash
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
cite about-plugin
about-plugin 'node version manager, as a bash function'

export NVM_DIR=$HOME/.nvm
export NVM_DIR="$HOME/.nvm"

if [ ! -d "$NVM_DIR" ]; then
mkdir $NVM_DIR
Expand Down
2 changes: 1 addition & 1 deletion plugins/available/pipsi.plugin.bash
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
cite about-plugin
about-plugin 'load pipsi, if you are using it'

if [[ -f $HOME/.local/bin/pipsi ]]
if [[ -f "$HOME/.local/bin/pipsi" ]]
then
export PATH=~/.local/bin:$PATH
fi
2 changes: 1 addition & 1 deletion plugins/available/rvm.plugin.bash
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
cite about-plugin
about-plugin 'load rvm, if you are using it'

[[ -s $HOME/.rvm/scripts/rvm ]] && source $HOME/.rvm/scripts/rvm
[[ -s "$HOME/.rvm/scripts/rvm" ]] && source "$HOME/.rvm/scripts/rvm"

# Check to make sure that RVM is actually loaded before adding
# the customizations to it.
Expand Down
2 changes: 1 addition & 1 deletion plugins/available/tmuxinator.plugin.bash
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
cite about-plugin
about-plugin 'sources tmuxinator script if available'

[[ -s $HOME/.tmuxinator/scripts/tmuxinator ]] && . $HOME/.tmuxinator/scripts/tmuxinator
[[ -s "$HOME/.tmuxinator/scripts/tmuxinator" ]] && . "$HOME/.tmuxinator/scripts/tmuxinator"
2 changes: 1 addition & 1 deletion plugins/available/todo/todo.sh
Original file line number Diff line number Diff line change
Expand Up @@ -536,7 +536,7 @@ shift $(($OPTIND - 1))
# defaults if not yet defined
TODOTXT_VERBOSE=${TODOTXT_VERBOSE:-1}
TODOTXT_PLAIN=${TODOTXT_PLAIN:-0}
TODOTXT_CFG_FILE=${TODOTXT_CFG_FILE:-$HOME/.todo/config}
TODOTXT_CFG_FILE=${TODOTXT_CFG_FILE:-"$HOME/.todo/config"}
TODOTXT_FORCE=${TODOTXT_FORCE:-0}
TODOTXT_PRESERVE_LINE_NUMBERS=${TODOTXT_PRESERVE_LINE_NUMBERS:-1}
TODOTXT_AUTO_ARCHIVE=${TODOTXT_AUTO_ARCHIVE:-1}
Expand Down
2 changes: 1 addition & 1 deletion plugins/available/z_autoenv.plugin.bash
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ autoenv_init()
typeset target home _file
typeset -a _files
target=$1
home="$(dirname $HOME)"
home="$(dirname "$HOME")"

_files=( $(
while [[ "$PWD" != "/" && "$PWD" != "$home" ]]
Expand Down
2 changes: 1 addition & 1 deletion template/bash_profile.template.bash
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#!/usr/bin/env bash

# Path to the bash it configuration
export BASH_IT=$HOME/.bash_it
export BASH_IT="$HOME/.bash_it"

# Lock and Load a custom theme file
# location /.bash_it/themes/
Expand Down

0 comments on commit 4510c9e

Please sign in to comment.