bug-bash
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: RFE: new option affecting * expansion


From: Ilkka Virta
Subject: Re: RFE: new option affecting * expansion
Date: Tue, 17 Aug 2021 16:53:43 +0300

On Tue, Aug 17, 2021 at 5:36 AM Dale R. Worley <worley@alum.mit.edu> wrote:

>    cat $( glob * )
>
> where glob would get one argument, "*", and output a list of file
> names.  A glob-by-modification-date program would be a better solution
> for this need, IMHO.
>

So that program would have to duplicate the globbing code, would need to be
kept in sync if the shell gained new globbing features, and would still end
up
using different globbing rules than the shell, since it couldn't know if
e.g. dotglob
or nocaseglob were set.

Even if you made it so that it didn't take a glob, but just a list of
filenames to
sort, you'd still need to run it as something like this to support arbitrary
filenames:

  mapfile -t -d '' files < <(sort-by-mtime -0 *)

As opposed to using a simple $(...) as you did above, or *(om) as in zsh,
that is. Well, the upside is it wouldn't require changes to the shell, but
doesn't
really look too handy to use.


reply via email to

[Prev in Thread] Current Thread [Next in Thread]