tech-userlevel archive

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

Re: Possible "new" redirect style for /bin/sh (needs a name)



On Sat, Apr 10, 2021 at 07:43:40PM -0400, Mouse wrote:
>[...]
> 
> > What I need to know is whether people think adding this to /bin/sh
> > (most probably including SMALL shells, as this is the kind of thing
> > useful to use in places like installation scripts) is worth the cost.
> 
> Personally, I would say "no", but just because I don't think something
> is worth doing doesn't mean it isn't.  This is not something I've ever
> wished for; indeed, I can't recall ever having even seen such code.
> (What I would prefer to see is more flexible piping.)

There is one usage of this feature that I see now: shell library, i.e.
chunks of code to 'dot' in a main script. If these chunks open fds, it
would be a nightmare to imagine how to ensure that the fd numbers don't
conflict. With "named fds", one can have namespace protection and can
refer to some_chunk_var without knowing the value (dynamically
allocated) and a main script can then incorporate safely various chunks
in various order.

And this can be useful at installation time (switching to different
chunks from the context).
-- 
        Thierry Laronde <tlaronde +AT+ polynum +dot+ com>
                     http://www.kergis.com/
                    http://kertex.kergis.com/
                       http://www.sbfa.fr/
Key fingerprint = 0FF7 E906 FBAF FE95 FD89  250D 52B1 AE95 6006 F40C


Home | Main Index | Thread Index | Old Index