zsh-users
 help / color / mirror / code / Atom feed
From: Ray Andrews <rayandrews@eastlink.ca>
To: zsh-users@zsh.org
Subject: Re: trivial question
Date: Tue, 6 Dec 2022 07:28:28 -0800	[thread overview]
Message-ID: <9210d692-ed2c-c853-a5bb-23d9d6a097b2@eastlink.ca> (raw)
In-Reply-To: <CAH+w=7buxWU3j0WXq3xe7m4c8caMKxfGZb9kqCqx5EjbH6nGWw@mail.gmail.com>

[-- Attachment #1: Type: text/plain, Size: 2315 bytes --]


On 2022-12-05 20:29, Bart Schaefer wrote:
>
> If you're asking what else are glob characters, you should probably
> attempt to understand the corresponding manual section.
>
If a word contains an unquoted instance of one of the characters ‘*’, 
‘(’, ‘|’, ‘<’, ‘[’, or ‘?’, it is regarded as a pattern for filename 
generation, unless the GLOB option is unset. If the EXTENDED_GLOB option 
is set, the ‘^’ and ‘#’ characters also denote a pattern; otherwise they 
are not treated specially by the shell.

What overloads me is the way pattern globbing (do we say that? or just 
call it 'pattern matching'?) and filename globbing are conflated in 
there.  So very similar but so subtly different. Anyway stuff is 
starting to stick to the inside of my skull.   At the very least I know 
where to expect trouble.  Obviously it's decades late to complain about 
any of this, but life would be simpler if it was explicit that one 
wanted to generate filenames or one wanted strings to be strings.  That 
way there'd be no need for a list of special characters. I know that 
echo doesn't decide how it's arguments will be handled, still it's 
intuitive that one echos a string.  But I suppose the rule is to quote 
anything you want to be immune to such expansions and it's as simple as 
that. Unquote and you're taking your chances.  Fair enough.  It's an 
early lesson.

Lawrence:

> You can observe this with XTRACE:

Gotta spend more time with that.  Output can be a bit overwhelming but slow and steady -- the information is in there.
A better tool is "typeset -p", which outputs an accurate (albeit
sometimes difficult-to-read) representation.

	% typeset -p arr
	typeset -a arr=( $'a\nb\C-Mc' $'d\C-Me\nf' )

Yes! It almost doesn't matter that it's hard to read, the point is to catch that one is not the same as the other.  Yup, that's a life-lesson.

Peter:

There's the special case of the GLOB_ASSIGN option where all
assignments, not just arrays, undergo globbing.  That's for
compatibility with early versions of zsh, otherwise it's very
confusing.

Deus absit.  What I might like is some way of turning it all off.  Like unsetopt glob, yes?  Actually, tho it started out as a purely academic question, I can now think of a place where I think I'll want to do that.



[-- Attachment #2: Type: text/html, Size: 3084 bytes --]

  parent reply	other threads:[~2022-12-06 15:29 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-12-05  2:05 Ray Andrews
2022-12-05  2:52 ` Lawrence Velázquez
2022-12-05  5:20   ` Ray Andrews
2022-12-05  6:40     ` Lawrence Velázquez
2022-12-05 14:11       ` Ray Andrews
2022-12-06  2:12         ` Lawrence Velázquez
2022-12-06  2:29           ` Ray Andrews
2022-12-06  4:29             ` Bart Schaefer
2022-12-06  6:08               ` Lawrence Velázquez
2022-12-06 10:18               ` Roman Perepelitsa
2022-12-06 11:21                 ` Peter Stephenson
2022-12-06 15:28               ` Ray Andrews [this message]
2022-12-06 18:53                 ` Bart Schaefer
2022-12-07  0:02                 ` Lawrence Velázquez

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=9210d692-ed2c-c853-a5bb-23d9d6a097b2@eastlink.ca \
    --to=rayandrews@eastlink.ca \
    --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).