#! /bin/sh
# replace spaces with underscores, lowercase everything, ditch multiple underscores, and ditch _.foo.
# should probably try to avoid overwriting existing files, but c'est la vie!
-set - $(getopt -u --longoptions 'anime' -- '' "$@")
+
+TEMP="$(getopt --longoptions 'anime' -- '' "$@")"
+eval set -- $TEMP
set -e
ANIME_CUT=0
done;
shift;
if [ "$ANIME_CUT" == 0 ]; then
- rename 's/\s+/\_/g; $_ = lc($_); s/\_+/\_/g; s/\_\././' "$@"
+ rename 's/\s+/\_/g; s/[^\w\d.]/\_/g; s/^_+//g; s/_$//g; $_ = lc($_); s/\_+/\_/g; s/\_\././' "$@"
else
rename 's/\[[^\]]+\]//g; s/^_+//; s/\s+/\_/g; $_ = lc($_); s/[_-]+/\_/g; s/\_\././' "$@"
fi;
\ No newline at end of file