From: Roman Neuhauser <neuhauser@sigpipe.cz>
To: "William G. Scott" <wgscott@ucsc.edu>
Cc: zsh-users@zsh.org
Subject: Re: regular expressions and setting variables?
Date: Tue, 10 Jun 2014 08:17:18 +0200 [thread overview]
Message-ID: <20140610061718.GA96641@isis.sigpipe.cz> (raw)
In-Reply-To: <157E3510-D220-4C1C-A452-93DE96DA4363@chemistry.ucsc.edu>
# wgscott@ucsc.edu / 2014-06-09 22:04:20 -0700:
> I?m trying to emulate how iTunes changes some names of directories it
> creates based on names of artists. For example, albums by the group
> R.E.M. are stored in a directory it creates called R.E.M_
>
> The final full-stop is replaced with an underscore, I assume to avoid
> complications in the unix filesystem.
i doubt that. "the unix filesystem" does not care about names at all,
well, almost: a filename cannot contain slashes and null bytes.
slash, because these are used to separate "foo" from "bar" in "foo/bar",
and null bytes, because "foo" and "bar" are stored in the filesystem
as C strings, where the null byte is used as terminator.
windows filesystems OTOH, among other limitations, prohibit names
ending with a dot.
> This works:
>
> JUNK=R.E.M.
> print ${JUNK}| perl -p -e 's|\.$|_|g?
>
> It returns
> R.E.M_
>
>
> But if I try to do this:
>
> print ${JUNK/\.$/_}
>
> it returns
> R.E.M.
>
> I assume I am not using the correct regexp.
kinda, the ${param/pat/rep} operation does not use regexps, the pattern
expects the globbing ("filename generation") syntax.
> What do I need to do to get this working?
man zshexpn.
--
roman
next prev parent reply other threads:[~2014-06-10 6:27 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-06-10 5:04 William G. Scott
2014-06-10 6:17 ` Roman Neuhauser [this message]
2014-06-10 8:45 ` Phil Pennock
2014-06-10 14:26 ` William G. Scott
2014-06-10 14:11 ` zzapper
-- strict thread matches above, loose matches on Subject: below --
2014-06-10 5:02 William G. Scott
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20140610061718.GA96641@isis.sigpipe.cz \
--to=neuhauser@sigpipe.cz \
--cc=wgscott@ucsc.edu \
--cc=zsh-users@zsh.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://git.vuxu.org/mirror/zsh/
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).