]> Sergey Matveev's repositories - torn.git/blobdiff - torn.zsh
Proper zsh spelling
[torn.git] / torn.zsh
index bc23537e603335664187ee70bf70925641a31ba4..df642d64f287ec8a499dd449eda24af06002a974 100755 (executable)
--- a/torn.zsh
+++ b/torn.zsh
@@ -5,9 +5,9 @@
 # it under the terms of the GNU General Public License as published by
 # the Free Software Foundation, version 3 of the License.
 
-# Initially this script was written on Perl, but now it is zsh function,
-# that is intended to be used with zmv command. It is much more flexible
-# to be used with zsh'es glob expansion.
+# Initially this script was written on Perl, but now it is Z shell
+# function, that is intended to be used with zmv command. It is much
+# more flexible to be used with zsh'es glob expansion.
 #
 # * transliterates everything
 # * replaces non FAT-compatible characters with underscores
@@ -52,6 +52,8 @@ tornm() {
     local n=$1
     n=${n:gs/ /_}
     n=${n//_[–-]_/-}
+    n=${n//_[–-]/-}
+    n=${n//[–-]_/-}
     n=${n:gs/,_/,}
     n=${n//[\[\]]/}
     n=${n:gs/_(/(}
@@ -76,7 +78,7 @@ torna() {
     print -- $n
 }
 
-[[ -n $1 ]] || exit
+[[ -n $1 ]] || return
 local n=${1:t}
 n=`tornm $n`
 n=`tornt $n`