bash : name : improve pattern matching.

This commit is contained in:
Dmitry Voronin 2023-10-25 14:47:09 +03:00
parent c4cef8a0f8
commit 30e0c964a2

View file

@ -20,9 +20,10 @@ name()
new_name=$(echo "$file" | \
sed -e "s/ /_/g" \
-e "s/[^[:alnum:]\._-]//g" \
-e "s/_\+/_/g" -e "s/\.\+/\./g" -e "s/-\+/-/g" \
-e "s/_-/_/g" -e "s/-_/_/g" -e "s/\.-/_/g" -e "s/-\./_/g" -e "s/\._/_/g" -e "s/_\./_/g" \
-e "s/_\+/_/g" \
-e "s/_-_/_/g" \
-e "s/^_\+//"
-e "s/^_//" -e "s/_$//"
)
# status line.