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:31 PM, ZyX <kp-pav@xxxxxxxxx> wrote:
> 18.01.2015, 21:36, "Nikolai Weibull" <now@xxxxxxx>:

>> 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.

> If you are OK with bash then you may use `shopt -s nullglob; shopt -s dotglob` and use `set -- *`.

I’m not.  Depending on Bash is like depending on Zsh these days, I’d
say, in terms of availability.

> Note that solution posted by Roman Neuhauser does handle names with spaces and tabs, but not newlines, if you set $IFS to a newline. As-is it has problems with all characters in IFS which are not just space, but also tab and newline.

The solution has to be functionally equivalent.



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