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

Re: (N) defaults to whole directory listing



On 2021-01-29 9:52 a.m., Lawrence Velázquez wrote:
mkdir -p foo/bar{1,2} && touch foo/bar{1,2}/baz && cd foo
Ah, right, I need 'ls -d *' to mirror plain 'ls'.  Anyway the point remains that ls has no way of knowing that zsh has removed the argument thus there is no failure to report.

    Have you considered using "setopt CSH_NULL_GLOB" and then not using (N) ...?

To avoid surprises it seems the ' 2> dev/null ' is going to satisfy.  In unnecessary detail what was happening was that in my wrapper I'd get this:

    1 /aWorking/Zsh/Source/Wk 3 $ l zzz

    LISTING of "zzz": all file types, INsensitive. Sorting upside down by: Mod. Time:

    drwxr-xr-x 10 20480 [2021-01-29--07:08] ./

    Items found: 1
    Total bytes in this directory: 2.8M
    Total including subdirs: 12M	

... there was always that annoying false find of 'dot'.  But  ' >2 /dev/null ' fixes it.  BTW the 'Items found' comes from using 'wc' but that too reports one item even if the output is zero which seems strange but it's fixable:

    1 /aWorking/Zsh/Source/Wk 3 $ . l; l zzz

    LISTING of "zzz": all file types, INsensitive. Sorting upside down by: Mod. Time:

    Nothing found

... so all's well.







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