zsh-users
 help / color / mirror / code / Atom feed
From: "Lawrence Velázquez" <larryv@zsh.org>
To: "Ray Andrews" <rayandrews@eastlink.ca>
Cc: zsh-users@zsh.org
Subject: Re: glob executable vs. non executable
Date: Thu, 27 Oct 2022 19:19:48 -0400	[thread overview]
Message-ID: <05b5bf81-267e-46ba-9be4-2aacb57bc0bb@app.fastmail.com> (raw)
In-Reply-To: <c4d4b6ca-3e11-531f-fd9f-5a16c53625f0@eastlink.ca>

On Thu, Oct 27, 2022, at 5:44 PM, Ray Andrews wrote:
> On 2022-10-27 13:02, Lawrence Velázquez wrote:
>> Strictly speaking, you could use a comma to separate the "*" and
>> "@" qualifiers; this denotes a logical disjunction.  (Juxtaposition
>> indicates a conjunction.)
>>
>>      all_unx=( (#i)${~1}(N*,@) )
>>
> Very good.  I couldn't find any documentation on that.

See zshexpn(1), in the paragraph immediately following the list of
glob qualifiers.  It is admittedly easy to overlook.

	More than one of these lists can be combined, separated by
	commas.  The whole list matches if at least one of the
	sublists matches (they are 'or'ed, the qualifiers in the
	sublists are 'and'ed).  Some qualifiers, however, affect
	all matches generated, independent of the sublist in which
	they are given.  These are the qualifiers 'M', 'T', 'N',
	'D', 'n', 'o', 'O' and the subscripts given in brackets
	('[...]').


>> However, as I said earlier, it is not useful to consider symbolic
>> links "executable"
>
> In my head the word might be 'actionable'.  Type some word at the prompt 
> and press ENTER and sometimes something happens.

By this definition, every possible command name is "actionable".
After all, *something* always happens.


> What I'm trying to 
> nail down is all the possibilities and what sorts of species they can 
> be.  In that frame of mind, a symlink is actionable so I consider it in 
> the same category as any other actionable word.

A symlink is not inherently more "actionable" than a regular file
that does not have executable permissions.  The target is what's
important, not the symlink.

	% ln -s /bin/date link_a
	% ln -s /etc/passwd link_b
	% ./link_a
	Thu Oct 27 18:32:17 EDT 2022
	% ./link_b
	zsh: permission denied: ./link_b

As I said in my last message, the "-" glob qualifier allows you to
include or exclude symlinks based on their targets' attributes.
There is no reason to blindly lump all symlinks together, when you
can easily pick out the ones that actually matter.


> Thanks Lawrence, you guys are so informative.  Learning zsh by myself 
> would be next to impossible.

No worries.


-- 
vq


  reply	other threads:[~2022-10-27 23:21 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-10-27 15:41 Ray Andrews
2022-10-27 20:02 ` Lawrence Velázquez
2022-10-27 21:44   ` Ray Andrews
2022-10-27 23:19     ` Lawrence Velázquez [this message]
2022-10-27 23:39       ` Ray Andrews

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=05b5bf81-267e-46ba-9be4-2aacb57bc0bb@app.fastmail.com \
    --to=larryv@zsh.org \
    --cc=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).