Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Re: translate all sequences of whitespace/underscores to single dashes



On Aug 17,  1:19pm, Stephane Chazelas wrote:
} Subject: Re: translate all sequences of whitespace/underscores to single d
}
} 2015-08-17 20:27:22 +0900, Jun T.:
} > BTW, the line
} > 	mv $f $new_name 2> /dev/null
} > in the function clean-filename() is dangerous
} 
} Note that zmv accounts for that (and also adds the missing
} "--") (and turns on extendedglob).
} 
} zmv '*' '${f//[-_[:space:]]##/-}'

Two additional points:

(1) The $f in Jun's warning has nothing to do with the the $f in 
    Stephane's example except that they coincidentally both were
    used as a variable holding a file name.

(2) That use of $f in zmv is explained in the comments in the zmv
    source file, but isn't mentioned in the man pages / info docs.



Messages sorted by: Reverse Date, Date, Thread, Author