From: Chris Koeritz Date: Thu, 20 Aug 2015 18:03:17 +0000 (-0400) Subject: stopped allowing ampersands in file names, added documentation lines. X-Git-Tag: 2.140.90~600 X-Git-Url: https://feistymeow.org/gitweb/?a=commitdiff_plain;h=4bd5169eb75c769397e1c86069f9d2356c89d63d;p=feisty_meow.git stopped allowing ampersands in file names, added documentation lines. --- diff --git a/scripts/files/replace_spaces_with_underscores.sh b/scripts/files/replace_spaces_with_underscores.sh index 560b7711..a26371d4 100644 --- a/scripts/files/replace_spaces_with_underscores.sh +++ b/scripts/files/replace_spaces_with_underscores.sh @@ -12,7 +12,11 @@ fi while [ $# -gt 0 ]; do file="$1"; shift - newname="$(echo "$file" | tr -s ' ' '_' | tr -d "\$\!@#%}{)(][\\\~',:?><\"" | sed -e 's/\([0-9]\)_\./\1./g' | sed -e 's/_-_/-/' )" + # first turn spaces into underscores. then process characters we don't want + # in names. then translate multiple underscores into just one. then turn + # number followed by underscore into just number (?). then translate + # underscore dash underscore into just dash. + newname="$(echo "$file" | tr -s ' ' '_' | tr -d "\$\!@&#%}{)(][\\\~',:?><\"" | sed -e 's/__/_/g' | sed -e 's/\([0-9]\)_\./\1./g' | sed -e 's/_-_/-/' )" if [ "$file" != "$newname" ]; then # we've effected a name change, so let's actually do it. echo "'$file' => '$newname'"