zsh-users
 help / color / mirror / code / Atom feed
From: "Lawrence Velázquez" <vq@larryv.me>
To: Ray Andrews <rayandrews@eastlink.ca>
Cc: zsh-users@zsh.org
Subject: Re: (N) defaults to whole directory listing
Date: Fri, 29 Jan 2021 12:52:58 -0500	[thread overview]
Message-ID: <7ED923BE-3073-40F6-956A-B81FABC6F2B2@larryv.me> (raw)
In-Reply-To: <7ea3f3f8-6aa9-bbab-40d7-2944b88e1709@eastlink.ca>

> On Jan 29, 2021, at 12:01 PM, Ray Andrews <rayandrews@eastlink.ca> wrote:
> 
>> On 2021-01-29 7:33 a.m., Roman Perepelitsa wrote:
>> 
>> `no_such_file(N)` expands to nothing if there is no file named
>> `no_such_file` in the current directory. This is in line with the
>> zsh documentation and what everyone expects.
> 
> That's about what I I expected to hear.  zsh can't be expected to
> feed 'ls' with something that duplicates a non-existent file, it
> can only remove the non-existent file thus leaving no argument

This only happens because you're using '(N)', which you could easily
drop if it's not desirable. It often is, though, so you need to be
aware of how the rest of your code works if a glob expands to
nothing.

> thus ls must be 'ls *'.

This is false.

	% mkdir -p foo/bar{1,2} && touch foo/bar{1,2}/baz && cd foo
	% ls
	bar1	bar2
	% ls *
	bar1:
	baz

	bar2:
	baz

You might be better off avoiding this sort of thing by testing your
globs with `print` (or something similar), as Roman demonstrated.

vq


  reply	other threads:[~2021-01-29 17:53 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-01-29 15:24 Ray Andrews
2021-01-29 15:33 ` Roman Perepelitsa
2021-01-29 17:01   ` Ray Andrews
2021-01-29 17:52     ` Lawrence Velázquez [this message]
2021-01-29 19:52       ` Ray Andrews
2021-01-29 18:47     ` Bart Schaefer
2021-01-29 19:04   ` Bart Schaefer
2021-01-30 10:50     ` Roman Perepelitsa
2021-01-30 15:00       ` Beverly Pope
2021-06-18 10:24     ` Why does >&- produce an error message when connected to a builtin? (was Re: (N) defaults to whole directory listing) Marlon Richert

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=7ED923BE-3073-40F6-956A-B81FABC6F2B2@larryv.me \
    --to=vq@larryv.me \
    --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).