Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Re: (N) defaults to whole directory listing



On Fri, Jan 29, 2021 at 7:33 AM Roman Perepelitsa
<roman.perepelitsa@xxxxxxxxx> wrote:
>
>   print -rC1 -- no_such_file(N)
>
> This will print `no_such_file` if such file exists and will do nothing
> otherwise.

Not precisely nothing ... it will print a newline.

>   ( ls -1 no_such_file(#q) ) 2>/dev/null

That can be done without a subshell:

{ ls no_such_file(#q) } 2>&-

However, that needs one of extendedglob or nobareglobqual, plus I
think he actually wants the error message.

To get the effect of (#q) without extendedglob, use (+true) ... but I
don't believe that's very useful in this specific example.




Messages sorted by: Reverse Date, Date, Thread, Author