On Thu, Nov 18, 2021 at 03:14:16AM +1100, Reuben ua Bríġ wrote:
> > Date: Thu, 18 Nov 2021 01:30:25 +1100
> > From: Reuben ua Bríġ <[email protected]>
> > 
> > Does anyone know of any shell and utilities where, for example, if
> > 
> >     -rf
> > 
> > is a file name, the rm utility will understand so, and not think it
> > is a controlling flag (ugh! in-band signalling)? One where an array
> > of strings can be past as a single argument? Etc? etc?  
> 
> > Date: Thu, 18 Nov 2021 01:38:14 +1100
> > From: Reuben ua Bríġ <[email protected]>
> > 
> > correction: is a file name expanded from a pattern, ...
> 
> I have gotten a number of replies that quite miss the point. I gave rm
> as a simple and readily understandable toy problem. The '--' trick is

Using -- is not a "trick".

> all very well if you only need one array of strings, but useless if you
> need more.

What is the "more" you need?

> I felt a more elegant solution would be a shell that can pass an array
> of strings as an argument, just as C can, and knows when to do so,
> rather than having each string as an argument. I wanted to know if
> there is already a shell that accomplishes that.--No need to reinvent
> the shell if someone has done so already.

Just make a habit of calling your utilities with -- to delimit options
from operands, especially if the operands are supplied from patterns or
other input that could result in words starting with a dash.  This is
not a trick.  Just common sense shell scripting practice.

> I do not need advice on how to use the UNIX shell and utilities. (Yuck!)

You're implying otherwise.

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

.

Reply via email to