On Fri, Nov 19, 2021 at 06:12:26PM +1100, Reuben ua Bríġ wrote:
> Hi Jonathan,
> 
> Thanks for your message which was the most helpful.
> I only just read it on marc.info.
> MS which serves the ANU mail is withholding mail.
> 
> I include some musings on rc that mightnt have made it to the list.
> The distributive concatenation feature of rc is a goodish solution,
> the best if it is required to use existing utilities.
> 
> As for rc lists, aside from distributing a flag as in
> 
>       c=* cc -c$c
> 
> it does not solve my problem as
> 
>       a (a b c) (a b c)
> 
> has the same effect as
> 
>       a a b c a b c
> 
> even if 'a' is a function defined in rc (as opposed to an external
> binary, which would require system cooperation).


In zsh, again, you can use ${^c} to make it "distribute" (it behaves
sort of as a brace expansion when combined with other strings), as
in rc.  In fact, this is actually enabling the shell option called
RC_EXPAND_PARAM for a single parameter expansion.

        touch a b c d
        c=(*)
        printf '"%s"\n' -c${^c}

output:

        "-ca"
        "-cb"
        "-cc"
        "-cd"


> 
> I think rc has a great non-disruptive solution, but it could be
> improved if the resulting concatenation could be made to be field
> separated (as described below).

As mentioned many times now:

        *(P[-c])    # in zsh

> Next I would change the shell to pass as a parameter an array of bits
> describing which arguments are expanded from patterns and therefore
> definitely filenames.

That would involve iterating over the arguments and testing whether
they correspond to an existing filename or not.  This may give false
positives.


> Next I would have it pass arguments of different types. Aside from the
> globbing issue, this would allow decisions about how to pass numerical
> input to be taken away from individual command and moved to the shell,
> allowing a more consistent user experience and easier programming.

You're basically advocating powershell.

> 
> Iwll get of my soap-box now.

And I'll stop not too as I've forgotten what your initial point was.  Go
ahead and use whatever shell you want.

Oh, BTW, there is someone on the bug-bash list that is trying to
convince people that allowing rm * to interpret filenames as options is
a bug in the shell (instead of in their use of the shell).  Needless to
say, they don't seem to get much support for their cause.


> 
> Thanks for your message, which was maybe the only one worth receiving,
> even if I didnt actually receive it.
> 
> > Date: Fri, 19 Nov 2021 14:40:45 +1059
> > From: Reuben ua Bríġ <[email protected]>
> > 
> > Even a distributive operator allowing
> > 
> >     compile -type1^* -type2^2/*
> > 
> > to be interpreted as
> > 
> >     compile -type 1 <*1> -type 1 <*2> ...
> > 
> > would be useful with existing utilities, but Im not aware of any.  
> 
> > Date: Fri, 19 Nov 2021 16:30:18 +1100
> > From: Reuben ua Bríġ <[email protected]>
> > 
> > I know rc(1) allows at least
> > 
> >     c=*
> >     cc -c$c
> > 
> > I dont think there is any way to make the resulting concatenation
> > field separated ('-c' '*1' ...) for those programs that need it, but
> > oh well. (But I havent read the grammar.)

-- 
Andreas (Kusalananda) Kähäri
SciLifeLab, NBIS, ICM
Uppsala University, Sweden

.

Reply via email to