Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
translate all sequences of whitespace/underscores to single dashes
- X-seq: zsh-users 20421
- From: Emanuel Berg <embe8573@xxxxxxxxxxxxx>
- To: zsh-users@xxxxxxx
- Subject: translate all sequences of whitespace/underscores to single dashes
- Date: Mon, 17 Aug 2015 02:20:12 +0200
- Cancel-lock: sha1:v+nX0FsFDmW3EQ6dIU9Wxx8yyPw=
- List-help: <mailto:zsh-users-help@zsh.org>
- List-id: Zsh Users List <zsh-users.zsh.org>
- List-post: <mailto:zsh-users@zsh.org>
- Mail-copies-to: never
- Mail-followup-to: zsh-users@xxxxxxx
- Mailing-list: contact zsh-users-help@xxxxxxx; run by ezmlm
How can I do this directly and only in zsh, i.e.
not using tr (translate characters)?
# whitespace(s) and underscore(s) -> (a single) dash
new_name=${new_name//[_ ]/-}
new_name=`echo $new_name | tr -s "-"`
Here is the file for context:
http://user.it.uu.se/~embe8573/conf/.zsh/files-fs
Feel free to help me with other issues in that file
as well.
--
underground experts united
http://user.it.uu.se/~embe8573
Messages sorted by:
Reverse Date,
Date,
Thread,
Author