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

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



18.01.2015, 21:36, "Nikolai Weibull" <now@xxxxxxx>:
> Hi!
>
> 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.
>
> Thanks!

If you are OK with bash then you may use `shopt -s nullglob; shopt -s dotglob` and use `set -- *`. 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.



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