From 2168cfa113ef394cf6597d1c5d81db8a7fa00ebe Mon Sep 17 00:00:00 2001 From: Mike Burns Date: Thu, 27 Feb 2014 16:52:06 +0100 Subject: Quote the PWD This allows for users to run this command from within directories that have spaces in their path. I've also quoted `DOTFILES_DIR` in more places, but this is so far a waste: we still don't support dotfiles directories with spaces in their name. --- bin/lsrc | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'bin') diff --git a/bin/lsrc b/bin/lsrc index 724fb44..ad16d40 100755 --- a/bin/lsrc +++ b/bin/lsrc @@ -270,16 +270,16 @@ $DEBUG "COPY_ALWAYS: $COPY_ALWAYS" : ${SYMLINK_DIRS:=""} $DEBUG "SYMLINK_DIRS: $SYMLINK_DIRS" -relative_root_dir=$PWD +relative_root_dir="$PWD" for DOTFILES_DIR in $DOTFILES_DIRS; do - cd $relative_root_dir + cd "$relative_root_dir" if is_relative $DOTFILES_DIR; then DOTFILES_DIR=$PWD/$DOTFILES_DIR fi - if [ ! -d $DOTFILES_DIR ]; then + if [ ! -d "$DOTFILES_DIR" ]; then $VERBOSE "skipping non-existent directory: $DOTFILES_DIR" continue fi @@ -290,7 +290,7 @@ for DOTFILES_DIR in $DOTFILES_DIRS; do symlink_dirs_file_globs=`dotfiles_dir_excludes $DOTFILES_DIR "$SYMLINK_DIRS"` $DEBUG "symlink_dirs_file_globs: $symlink_dirs_file_globs" - cd $DOTFILES_DIR + cd "$DOTFILES_DIR" DIR_STACK=":$DOTFILES_DIR" for file in ${FILES:-*}; do @@ -301,7 +301,7 @@ for DOTFILES_DIR in $DOTFILES_DIRS; do handle_file $file $DEST_DIR $DOTFILES_DIR . 0 "$exclude_file_globs" "$include_file_globs" "$symlink_dirs_file_globs" done - cd $DOTFILES_DIR + cd "$DOTFILES_DIR" host_files=$DOTFILES_DIR/host-$HOSTNAME if [ -d $host_files ]; then @@ -312,7 +312,7 @@ for DOTFILES_DIR in $DOTFILES_DIRS; do popdir fi - cd $DOTFILES_DIR + cd "$DOTFILES_DIR" for tag in $TAGS; do if [ -d tag-$tag ]; then -- cgit v1.2.3