From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 10058 invoked by alias); 18 Jan 2015 20:32:26 -0000 Mailing-List: contact zsh-users-help@zsh.org; run by ezmlm Precedence: bulk X-No-Archive: yes List-Id: Zsh Users List List-Post: List-Help: X-Seq: 19743 Received: (qmail 6822 invoked from network); 18 Jan 2015 20:32:15 -0000 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on f.primenet.com.au X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00 autolearn=ham version=3.3.2 Date: Sun, 18 Jan 2015 21:32:13 +0100 From: Roman Neuhauser To: Nikolai Weibull Cc: Zsh Users Subject: Re: Equivalent of set -- *(DN) in sh Message-ID: <20150118203213.GH979@isis.sigpipe.cz> References: <20150118190723.GG979@isis.sigpipe.cz> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-2 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: User-Agent: Mutt/1.5.23 (2014-03-12) # now@disu.se / 2015-01-18 20:43:55 +0100: > On Sun, Jan 18, 2015 at 8:07 PM, Roman Neuhauser wrote: > > # now@disu.se / 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, then use `find ...`, problem solved. btw if your requirements are this stringent you would have done well if you laid them out upfront. > -maxdepth is GNU specific it's not, at least all BSDs have it as well. again, what operating systems do you need to support? > and .* and * will be expanded by the shell, not by find you can `find . -maxdepth 1 -mindepth 1`, but the paths will be prefixed with "./". you could of ocurse append `| sed 's:..::'`. OTOH, what's the problem with the shell expanding the globs? if .* or * does not exist, sh leaves that there as-is, find cannot chdir into it, and definitely won't print it. > Oh, and who said anything about only including directories? ;-) yeah, that was a brainfart, sorry. -- roman