zsh-workers
 help / color / mirror / code / Atom feed
From: Stephane Chazelas <stephane@chazelas.org>
To: Zsh hackers list <zsh-workers@zsh.org>
Subject: tilde expansion after quoted : in assignments
Date: Fri, 30 Apr 2021 09:17:16 +0100	[thread overview]
Message-ID: <20210430081716.vlez4jbb7c72vorf@chazelas.org> (raw)
In-Reply-To: <20210430065123.zjq2mpanmtbkkgfl@chazelas.org>

2021-04-30 07:51:23 +0100, Stephane Chazelas:
[...]
> BTW, zsh is the only shell where ~ is expanded in:
> 
> $ zsh -c 'a=a\:~; echo $a'
> a:/home/chazelas
[...]

That's a POSIX non-conformance btw:

https://pubs.opengroup.org/onlinepubs/9699919799.2018edition/utilities/V3_chap02.html#tag_18_06_01

Tilde expansion is only meant to be done after unquoted : per
POSIX. Though I can't imagine being a problem in practice. If
people don't want tilde expansion, they'd quote the ~, not the
:.

Also, there's a lot of variation between shells in how tilde
expansion is done and the specification is quite vague there.

See also ~$user or ~"user" or var=foo$COLON~ or var=foo${-+:}~
...

See also https://www.austingroupbugs.net/view.php?id=1172
(I had completely forgotten I'd raised that).

-- 
Stephane


  reply	other threads:[~2021-04-30  8:17 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-04-29 23:53 Bug in Functions/Misc/regexp-replace Jacob Menke
2021-04-30  0:40 ` Matthew Martin
2021-04-30  5:56   ` Stephane Chazelas
2021-04-30  6:51 ` Stephane Chazelas
2021-04-30  8:17   ` Stephane Chazelas [this message]
2021-04-30 17:43     ` tilde expansion after quoted : in assignments Bart Schaefer
2021-04-30 20:13   ` Bug in Functions/Misc/regexp-replace Jacob Menke
2021-04-30 21:22     ` Bart Schaefer
2021-04-30 20:43   ` Bart Schaefer

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=20210430081716.vlez4jbb7c72vorf@chazelas.org \
    --to=stephane@chazelas.org \
    --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).