zsh-workers
 help / color / mirror / code / Atom feed
From: Peter Stephenson <p.stephenson@samsung.com>
To: Dino Ruic <dr@ithe.rwth-aachen.de>, zsh-workers@zsh.org
Subject: Re: bug with sed and escaping?
Date: Wed, 10 Apr 2013 11:00:33 +0100	[thread overview]
Message-ID: <20130410110033.7ae32aba@pwslap01u.europe.root.pri> (raw)
In-Reply-To: <51653426.1000600@ithe.rwth-aachen.de>

On Wed, 10 Apr 2013 11:43:02 +0200
Dino Ruic <dr@ithe.rwth-aachen.de> wrote:
> Zsh:
> $ echo "xy" | sed -e s/^x//
> zsh: no matches found: s/^x//

The "^" is doing a form of enhanced file name generation: what you've
typed means "match all files that start with 's/' and then continue with
anything that isn't 'x//'", which obviously isn't what you want.  If
you're not using the additional pattern matching features of ^, ~, #, |
and parentheses as documented in the zshexpn manual page, you can
"unsetopt extendedglob".  It's not on by default, so something in your
initialisation files is setting it.

Generally, however, you really need to decide if you actually need raw
Bourne shell stuff to work --- in which case it's possible to get zsh to
emulate it more fully, but in that case you might be better off with a
shell that does it by default, depending what it is you're trying to do
--- or if all you want is to learn how zsh works and adapt to it.  In
the latter case, quoting is the right way to go in this particular case.

(I'd actually recommend single quotes --- it'll work in this case with
double quotes, but expressions involving '^' also have a meaning to
history expansion, so single quotes are a bit safer.  This is probably
week 3 of the beginner's zsh class rather than week 1 :-).)

pws


  reply	other threads:[~2013-04-10 10:00 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-04-10  9:43 Dino Ruic
2013-04-10 10:00 ` Peter Stephenson [this message]
2013-04-10 11:06   ` Dino Ruic

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=20130410110033.7ae32aba@pwslap01u.europe.root.pri \
    --to=p.stephenson@samsung.com \
    --cc=dr@ithe.rwth-aachen.de \
    --cc=zsh-workers@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).