From 649e4a849afc44129c95bc98ed86222a4ec2264c Mon Sep 17 00:00:00 2001 From: TiynGER Date: Tue, 18 Feb 2020 14:55:02 +0100 Subject: [PATCH] cleanname is now less bloated and doesnt use perl anymore --- .local/bin/etc/cleanname | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/.local/bin/etc/cleanname b/.local/bin/etc/cleanname index 783356a..21de3a5 100755 --- a/.local/bin/etc/cleanname +++ b/.local/bin/etc/cleanname @@ -1,3 +1,9 @@ #!/bin/sh [ -z "$1" ] && (echo "Error: missing argument (what to remain)" && exit) -perl-rename 's/\ /_/g; y/[A-Z]/[a-z]/; s/Ö/oe/g; s/ö/oe/g; s/Ä/ae/g; s/ä/ae/g; s/Ü/ue/g; s/ü/ue/g; s/ß/ss/g' "$1" +for oldname in "$@" +do + newname=`echo "$oldname" | tr '[:upper:]' '[:lower:]' | sed 's/\ /_/g; s/Ö/oe/g; s/Ä/ae/g; s/Ü/ue/g; s/ö/oe/g; s/ä/ae/g; s/ü/ue/g; s/ß/ss/g'`; + if [[ "$oldname" != "$newname" ]]; then + mv "$oldname" "$newname"; + fi +done