bug-bash
[Top][All Lists]
Advanced

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

Re: Feature Request: scanf-like parsing


From: pepa65
Subject: Re: Feature Request: scanf-like parsing
Date: Sat, 23 Jan 2021 00:47:58 +0700
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.10.0

On 22/01/2021 23.10, Léa Gris wrote:
> I'd prefer a syntax based off:
> 
> command-list > >(command-list)
> command-list < <(command-list)
> 
> But with curly braces for the no sub-shell version:
> 
> command-list > >{ command-list;}
> command-list < <{ command-list;}
> 
> Which could be used to assign output of a command to a variable without
> a sub-shell:
> 
> mapfile -t users < <{ compgen -u; } # No sub-shell

That would be great. Of course mapfile maps lines to entries in an
array, but if I want them in a single variable, perhaps this could do:

{ ls;}>>>variable

Or even (if people prefer):

mapvar variable < <{ ls;}

It is otherwise very hard to get command output into a variable without
a subshell.

Peter



reply via email to

[Prev in Thread] Current Thread [Next in Thread]