You have a fundamental misunderstanding of what a shell is, how a program 
executes, and how arguments to that program are passed.

You pass arguments to a program through a SINGLE ARRAY.

This is true in every operating system.

Stop advocating for things you don’t understand.

> On Nov 19, 2021, at 11:57 AM, Reuben ua Bríġ <u5644...@anu.edu.au> wrote:
> 
> 
>> 
>> Date: Fri, 19 Nov 2021 18:12:26 +1100
>> From: Reuben ua Bríġ <u5644...@anu.edu.au>
>> 
>> 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 <andreas.kah...@abc.se>
>> 
>> 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.
> 
> /* we are in sh(1) */
> 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.
> 

Reply via email to