From 1be0b88906d910a0aa449ba2b151107d50986a2d Mon Sep 17 00:00:00 2001 From: patrick brisbin and Mike Burns Date: Thu, 27 Feb 2014 11:20:31 -0500 Subject: 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`. --- bin/rcdn | 12 ++++++++---- bin/rcup | 10 ++++++---- 2 files changed, 14 insertions(+), 8 deletions(-) (limited to 'bin') diff --git a/bin/rcdn b/bin/rcdn index d6c90e9..3550a30 100755 --- a/bin/rcdn +++ b/bin/rcdn @@ -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" diff --git a/bin/rcup b/bin/rcup index 0e91ddd..c1cdc8e 100755 --- a/bin/rcup +++ b/bin/rcup @@ -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" -- cgit v1.2.3