zsh-users
 help / color / mirror / code / Atom feed
From: Bart Schaefer <schaefer@brasslantern.com>
To: Zsh Users <zsh-users@sunsite.dk>
Subject: Re: Why this expansion doesn't work?
Date: Sun, 13 Mar 2005 17:16:26 +0000	[thread overview]
Message-ID: <1050313171626.ZM18705@candle.brasslantern.com> (raw)
In-Reply-To: <20050313093915.GA81@DervishD>

On Mar 13, 10:39am, DervishD wrote:
}
} > What you should see is "Hellon", not "Hello".
} 
}     That's weird :(( I still have open the console where I saw that,
} but in a new virtual console that doesn't happen

Cosmic rays.

} > The first parse removes the quotes and one of the backslashes, and the
} > second parse removes the remaining backslash.
} 
}     So I must use something like:
} 
}     eval printf -- \"Hello\\n\"

Yes, except of course that means something considerably different when
there are spaces or metacharacters in the (no longer double-quoted on
the first parse) string.  More likely you want

	eval printf -- \""Hello\\n"\"

}     I forgot that the double quotes were removed :((( Is there any
} way of seeing how a command line is parsed *just before* being
} executed by the shell?

setopt xtrace

(or the equivalent "set -x").  Note that xtrace in recent versions of
zsh re-quotes the output so that it's suitable for cut-and-paste; old
versions (4.0.x and before) show the fully-unquoted result, but there
it's difficult to see where the shell split strings into words.

So e.g.

zagzig% set -x
zagzig% eval printf -- \""Hello\\n"\"
+Src/zsh:2> eval printf -- '"Hello\n"'
+(eval):1> printf -- 'Hello\n'
Hello
zagzig% 


  reply	other threads:[~2005-03-13 17:18 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-03-12 10:14 Why this " DervishD
2005-03-12 20:49 ` Bart Schaefer
2005-03-13  9:39   ` Why this expansion " DervishD
2005-03-13 17:16     ` Bart Schaefer [this message]
2005-03-14 10:50       ` DervishD

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=1050313171626.ZM18705@candle.brasslantern.com \
    --to=schaefer@brasslantern.com \
    --cc=zsh-users@sunsite.dk \
    /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).