summaryrefslogtreecommitdiff
path: root/bin
diff options
context:
space:
mode:
authorGravatar patrick brisbin and Mike Burns <pbrisbin@gmail.com>2014-02-27 11:20:31 -0500
committerGravatar Mike Burns <mike@mike-burns.com>2014-03-05 16:02:20 +0100
commit1be0b88906d910a0aa449ba2b151107d50986a2d (patch)
tree3572cf945385c28d0906e12a1f3270cc6adec36f /bin
parent640a7f9de8f5de8953e74c8d322c3fc21af4e4a9 (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-xbin/rcdn12
-rwxr-xr-xbin/rcup10
2 files changed, 14 insertions, 8 deletions
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"