On Sat, Nov 20, 2021 at 03:00:18AM +1100, Reuben ua Bríġ wrote:
> > Date: Fri, 19 Nov 2021 18:12:26 +1100
> > From: Reuben ua Bríġ <[email protected]>
> >
> > 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.  
> 
> > Date: Fri, 19 Nov 2021 16:23:02 +0100
> > From: Andreas Kusalananda Kähäri <[email protected]>
> >
> > That would involve iterating over the arguments and testing whether
> > they correspond to an existing filename or not.  This may give false
> > positives.
> 
> What?
> The shell already expands globs to form arguments.

Sure, but argumets may also be other strings
that are not the result of globbing.

> 
> /* we are in sh(1) */

Ah.  This is powershell all over again then.

> If ($n has just been expanded from a glob)
> { have sh(1) store a 0 in the nth bit of some words; }
> else { store a 1 in ...; }
> Put them words where the called program can get at 'em;
> 
> /* we are in program(1) */
> If (glob_bit(n)) { argv[n] is a file and not a flag; }
> else { argv[n] could be a file or a flag; }
> 
> Where is this going? On my disk, thats where!
> 
> > You're basically advocating powershell.
> 
> I wouldnt know, but I would be .very. surprised.
> 
> > 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.
> 
> Good on em.

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

.

Reply via email to