I realize I somewhat misrepresented my own proposal; it's closer to `export
thearr ...`, `importas -s files thearr` and `importas -s newfiles thearr`.
Call it envglob; elglob can even be implemented on top of it via
elgetpositionals -> envglob -> importas with intentional serial
substitution.
Nevertheless, the pattern of defining two variables with the same contents
persists, and this variant requires more careful handling of `-u` in
`importas`. I honestly find `define`-renaming (and Emanuele's proposed
extension) a more maintainable pattern, and it's the one I use in my own
scripts.
Em sáb., 25 de mai. de 2024 04:40, Laurent Bercot <ska-skaware_at_skarnet.org>
escreveu:
> >I don't understand what you mean by that; $foo/${foo} in $newfiles won't
> >expand because multisubstitute is being used to expand both $foo and
> >$newfiles.
>
> Oh. Yes, of course. I was wrong about that, sorry.
>
> That's an interesting workaround indeed, but it still feels like a
> workaround, and I'd rather not encourage the pattern. I prefer
> Eduardo's suggested solution of encoding elglob's result - but then
> again, it's still the same pattern where you expand the file list
> with define -s in a multisubstitute. Maybe the pattern in unavoidable.
>
> I'll think about it more and do *something*. Thanks for the long
> explanation.
>
> --
> Laurent
>
>
Received on Mon May 27 2024 - 21:10:48 CEST