From c4cef8a0f80c986371826165e5761bc97f622738 Mon Sep 17 00:00:00 2001 From: desktop Date: Wed, 25 Oct 2023 14:40:39 +0300 Subject: [PATCH] bash : name : improve matching. --- document/linux/config/bash/module/name.sh | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/document/linux/config/bash/module/name.sh b/document/linux/config/bash/module/name.sh index 1887ea7..800312f 100644 --- a/document/linux/config/bash/module/name.sh +++ b/document/linux/config/bash/module/name.sh @@ -18,8 +18,11 @@ name() # extract new name. new_name=$(echo "$file" | \ - sed -e "s/[^[:alnum:]\.]/_/g" \ - -e "s/_\+/_/g" + sed -e "s/ /_/g" \ + -e "s/[^[:alnum:]\._-]//g" \ + -e "s/_\+/_/g" \ + -e "s/_-_/_/g" \ + -e "s/^_\+//" ) # status line.