diff options
author | Mike Burns and Eric Collins <mike@mike-burns.com> | 2016-12-23 16:18:40 -0500 |
---|---|---|
committer | Mike Burns and Eric Collins <mike@mike-burns.com> | 2016-12-26 16:39:20 -0500 |
commit | 147a7b66554b2b13bcbf6fec1204e0cc0a1790bf (patch) | |
tree | 6539b10986afe5babef3decb2991cd5bb11ac08b /bin/mkrc.in | |
parent | 0651e4f5e0e71b57d6564f2f2887ab98f13f1995 (diff) |
Handle spaces in dotfile name
In mkrc, separate the list of files with newlines instead of spaces.
Change the `$IFS` when iterating to handle this.
We hand the file off to rcup, which encodes the file name by replacing
spaces with the bell character (`\a`).
rcup then sends the file name off to lsrc, which decodes the bell back
into a space.
The test makes sure an `a` character is in the filename, in case some
encoding goes wrong. We use tr(1) instead of sed(1) because tr(1)
handles `\a`.
Shoutout to Sublime Text 3 for forcing this issue.
Diffstat (limited to 'bin/mkrc.in')
-rwxr-xr-x | bin/mkrc.in | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/bin/mkrc.in b/bin/mkrc.in index da22a63..5b2dea5 100755 --- a/bin/mkrc.in +++ b/bin/mkrc.in @@ -82,7 +82,10 @@ if [ $always_copy -eq 1 ]; then INSTALL="$INSTALL -C" fi -files=$@ +files="" +for i; do + files="$(printf "$files\n$i")" +done if [ $force_symlink -eq 1 ]; then for file in $files; do @@ -108,7 +111,11 @@ elif [ $undotted -eq 0 ]; then done fi +saved_IFS="$IFS" +IFS=' +' for file in $files; do + IFS="$saved_IFS" case "$file" in /*) : ;; *) [ -e "$PWD/$file" ] && file="$PWD/$file" ;; |