:: Re: [DNG] [OT] bash / quote weirdne…
Etusivu
Poista viesti
Vastaa
Lähettäjä: Alessandro Vesely
Päiväys:  
Vastaanottaja: dng
Aihe: Re: [DNG] [OT] bash / quote weirdness
On Wed 12/Jan/2022 01:27:45 +0100 Florian Zieboll via Dng wrote:
> On Tue, 11 Jan 2022 18:52:10 -0500
> william moss <bill.m.moss@???> wrote:
>
>> Bash is taking the string in the double quotes as a single command;
>> this is well documented. If either the command or parameters have
>> spaces, you will have to use eval. Check the bash man page for
>> details.
>>
>> This will also usually work
>>     X=$( "command and such" )
>> due to the execute block.

>
> I am replying to the list to share the valid (tested) alternative.
> Thanks a lot!



Bash still considers a quoted command as such, for example:

ale@pcale:~/tmp$ X=$("echo foo")
bash: echo foo: command not found


Best
Ale
--