diff options
author | Christian HoĢltje <docwhat@gerf.org> | 2018-06-07 16:23:30 -0400 |
---|---|---|
committer | Mike Burns <mburns@thoughtbot.com> | 2018-07-06 10:19:20 -0400 |
commit | c263d2b097a7c6bb398491e79f8104213046f38c (patch) | |
tree | e7bc097798d773f52e45494b25764c383c25d0c9 /bin | |
parent | 4c24f176c3dc6b16d3464d4c2e80eef62e5d2673 (diff) |
avoid cd having issues with paths that begin with -
Diffstat (limited to 'bin')
-rwxr-xr-x | bin/lsrc.in | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/bin/lsrc.in b/bin/lsrc.in index 5a0774a..6fb6162 100755 --- a/bin/lsrc.in +++ b/bin/lsrc.in @@ -6,7 +6,7 @@ pushdir() { DIR_STACK="$DIR_STACK:$PWD/$1" $DEBUG "cd'ing to $1 from $PWD with stack $DIR_STACK" - cd "$1" + cd -- "$1" } popdir() { @@ -14,7 +14,7 @@ popdir() { prior="$(echo "$DIR_STACK" | sed -e "s|:$current$||" | sed -e 's/.*://g')" DIR_STACK="$(echo "$DIR_STACK" | sed -e 's/:[^:]*$//')" $DEBUG "cd'ing to $prior from $PWD with stack $DIR_STACK" - cd "$prior" + cd -- "$prior" } build_path() { @@ -318,7 +318,7 @@ $DEBUG "NEVER_UNDOTTED: $NEVER_UNDOTTED" relative_root_dir="$PWD" for DOTFILES_DIR in $DOTFILES_DIRS; do - cd "$relative_root_dir" + cd -- "$relative_root_dir" DOTFILES_DIR="$(eval echo "$DOTFILES_DIR")" @@ -343,7 +343,7 @@ for DOTFILES_DIR in $DOTFILES_DIRS; do never_undotted_file_globs="$(dotfiles_dir_excludes "$DOTFILES_DIR" "$NEVER_UNDOTTED")" $DEBUG "never_undotted_file_globs: $never_undotted_file_globs" - cd "$DOTFILES_DIR" + cd -- "$DOTFILES_DIR" DIR_STACK=":$DOTFILES_DIR" host_files="$DOTFILES_DIR/host-$HOSTNAME" @@ -361,7 +361,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 @@ -379,7 +379,7 @@ for DOTFILES_DIR in $DOTFILES_DIRS; do fi done - cd "$DOTFILES_DIR" + cd -- "$DOTFILES_DIR" for escaped_file in ${FILES:-*}; do file="$(decode "$escaped_file")" |