aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGravatar Jonas Gunz <himself@jonasgunz.de> 2020-09-19 14:29:39 +0200
committerGravatar Jonas Gunz <himself@jonasgunz.de> 2020-09-19 14:29:39 +0200
commit612634c364db841ef61ad0911b795a6e82afc3f1 (patch)
tree214b32b60b384c458860586acf8df191de8b1f0a
parentaee833735d45875f1703baffa21514e99118aa03 (diff)
downloaddotfiles-612634c364db841ef61ad0911b795a6e82afc3f1.tar.gz
bulkrename mktemp
-rwxr-xr-xscripts/bulkrename.sh6
1 files changed, 2 insertions, 4 deletions
diff --git a/scripts/bulkrename.sh b/scripts/bulkrename.sh
index 9df17d2..186326a 100755
--- a/scripts/bulkrename.sh
+++ b/scripts/bulkrename.sh
@@ -5,9 +5,7 @@
EDITOR=${EDITOR=:vi}
-while [ -z "$TMPFILE" -o -e "$TMPFILE" ]; do
- TMPFILE="/tmp/bulkrename.$RANDOM"
-done
+TMPFILE="$(mktemp)"
touch "$TMPFILE"
FILES=( )
@@ -31,7 +29,7 @@ while read line; do
if [ -e "${FILES[$i]}" -a ! -e "$line" ]; then
mv "${FILES[$i]}" "$line"
else
- echo Error. does target already exist?
+ echo "Skipping ${FILES[$i]} -> $line . Target already exists."
fi
fi