fnfix (418B)
1 #!/bin/sh 2 # rename all files passed as arguments containing danish characters. 3 4 replacerules() { 5 sed 's/æ/ae/g 6 s/ø/oe/g 7 s/Ã¥/aa/g 8 s/Æ/AE/g 9 s/Ø/OE/g 10 s/Ã…/AA/g 11 s/æ/ae/g 12 s/ë/ae/g 13 s/ø/oe/g 14 s/õ/oe/g 15 s/Ø/OE/g 16 s/ù/OE/g 17 s/Å/AA/g 18 s/ü/ue/g' 19 } 20 21 for f in "$@"; do 22 r="$(printf '%s' "$f" | replacerules)" 23 if [ ! "$f" = "$r" ]; then 24 mv -i "$f" "$r" 25 fi 26 done