Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: Equivalent of set -- *(DN) in sh
- X-seq: zsh-users 19740
- From: ZyX <kp-pav@xxxxxxxxx>
- To: Nikolai Weibull <now@xxxxxxx>, Zsh Users <zsh-users@xxxxxxx>
- Subject: Re: Equivalent of set -- *(DN) in sh
- Date: Sun, 18 Jan 2015 22:31:38 +0300
- Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yandex.ru; s=mail; t=1421609499; bh=Q4HKyDmhCh1QGNEVRMyOFeEh3JYNQj/qO3N4yFr9Vyc=; h=From:To:In-Reply-To:References:Subject:Date; b=FS7GY1ZLIXXiekISD2TUOUN2WeyGaDP2m0E5prIR36Wa8IVDb7KsZU2BMLrzUmgWN FsN3iqJn6XA1wktLizVINVNHv5FNeAceELOPVeT+lrKU5ENczzoGinGupKxeN8D1F+ BohYyj3gVf9HGgjj8pZqwj3lZJSY0mdpQWu1+drk=
- In-reply-to: <CADdV=MvMtwYczr82GeYkmVwTFCKgFcbgYS71XdnHZN_JqFqzTg@mail.gmail.com>
- List-help: <mailto:zsh-users-help@zsh.org>
- List-id: Zsh Users List <zsh-users.zsh.org>
- List-post: <mailto:zsh-users@zsh.org>
- Mailing-list: contact zsh-users-help@xxxxxxx; run by ezmlm
- References: <CADdV=MvMtwYczr82GeYkmVwTFCKgFcbgYS71XdnHZN_JqFqzTg@mail.gmail.com>
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