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

Re: Equivalent of set -- *(DN) in sh



On Sun, Jan 18, 2015 at 8:07 PM, Roman Neuhauser <neuhauser@xxxxxxxxxx> wrote:
> # now@xxxxxxx / 2015-01-18 19:28:42 +0100:
>> Is there any way to get the equivalent of Zsh´s
>>
>> set -- *(DN)
>>
>> in sh?  Most important here would be NULL_GLOB, as, by default, sh
>> simply leaves the * if there are no files to match.
>
> set -- $(find .* * -maxdepth 0 -type d)
>
> does not handle names with spaces.

Which is unsatisfactory, as $() isn’t in all versions of sh, -maxdepth
is GNU specific, and .* and * will be expanded by the shell, not by
find, so we’ve gained nothing and lost quite a bit.  Oh, and who said
anything about only including directories?  ;-)



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