diff options
author | patrick brisbin and Mike Burns <pbrisbin@gmail.com> | 2014-02-27 11:20:31 -0500 |
---|---|---|
committer | Mike Burns <mike@mike-burns.com> | 2014-03-05 16:02:20 +0100 |
commit | 1be0b88906d910a0aa449ba2b151107d50986a2d (patch) | |
tree | 3572cf945385c28d0906e12a1f3270cc6adec36f /bin | |
parent | 640a7f9de8f5de8953e74c8d322c3fc21af4e4a9 (diff) |
Quote $@
Most of this commit is actually about $IFS.
Modifying the environment for a single invocation (i.e. with `VAR=x
command` or `env VAR=x command`) only works for actual commands, not a
built-in like `set`. Consequently, we must manually store the existing
$IFS value and restore it after invoking `set`.
Diffstat (limited to 'bin')
-rwxr-xr-x | bin/rcdn | 12 | ||||
-rwxr-xr-x | bin/rcup | 10 |
2 files changed, 14 insertions, 8 deletions
@@ -89,11 +89,15 @@ handle_command_line "$@" run_hooks pre down -for dest_and_src in $(lsrc $LS_ARGS); do - saved_ifs=$IFS +dests_and_srcs="$(lsrc $LS_ARGS)" + +saved_ifs="$IFS" +IFS=' +' +for dest_and_src in $dests_and_srcs; do IFS=: - set $dest_and_src - IFS=$saved_ifs + set -- $dest_and_src + IFS="$saved_ifs" dest="$1" sigil="$3" @@ -164,13 +164,15 @@ handle_command_line "$@" run_hooks pre up -saved_ifs=$IFS +dests_and_srcs="$(lsrc $LS_ARGS)" + +saved_ifs="$IFS" IFS=' ' -for dest_and_src in $(lsrc $LS_ARGS); do +for dest_and_src in $dests_and_srcs; do IFS=: - set $dest_and_src - IFS=$saved_ifs + set -- $dest_and_src + IFS="$saved_ifs" dest="$1" src="$2" sigil="$3" |