diff options
author | VG <vg@devys.org> | 2016-01-25 20:50:11 +0100 |
---|---|---|
committer | VG <vg@devys.org> | 2016-01-25 20:50:11 +0100 |
commit | e7a8d9b69d459aaaa83204689a0e34862391035d (patch) | |
tree | b59155dba2e28ebfa073d3821b1d3714ecf11eba | |
parent | 846f5ff2705fc38ea1b0ba74d2af54e2fb5a4579 (diff) | |
download | bulkrename-e7a8d9b69d459aaaa83204689a0e34862391035d.tar.gz bulkrename-e7a8d9b69d459aaaa83204689a0e34862391035d.tar.bz2 bulkrename-e7a8d9b69d459aaaa83204689a0e34862391035d.zip |
reduce filename handling cornercases
be more robust if TMPDIR contains some unusual characters
-rwxr-xr-x | bulkrename | 10 |
1 files changed, 4 insertions, 6 deletions
@@ -20,9 +20,8 @@ exec </dev/tty >/dev/tty || { echo 'Interactive terminal needed' >&2 ; exit 1; } sed -i -- '1d' "${namebase}.2" if [ $(wc -l < "${namebase}.1") -ne $(wc -l < "${namebase}.2") ] ; then - rm -r "$(dirname "${namebase}")" - echo "Wrong number of lines" >&2 - exit 1 + rm -r -- "$(dirname -- "${namebase}")" + echo "Wrong number of lines" >&2 ; exit 1 fi sed -i -- 's/\([\\"$`]\)/\\\1/g;' "${namebase}.1" "${namebase}.2" @@ -35,10 +34,9 @@ sed -i -- 's/\([\\"$`]\)/\\\1/g;' "${namebase}.1" "${namebase}.2" > "${namebase}.sh" if [ "$(wc -c < "${namebase}.sh")" -ne 0 ] ; then - - "$EDITOR" "${namebase}.sh" + "$EDITOR" -- "${namebase}.sh" sh -e -- "${namebase}.sh" echo "bulkrename is done" fi -rm -r "$(dirname "${namebase}")" +rm -r -- "$(dirname "${namebase}")" |