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

Resolved: Re: OT: Bash: what is eval doing here?



Intentionaly top posting: I just wanted to say that the question is resolved, 
and record my understanding.

Thanks to all who replied!

Repeating the command for posterity: 

eval `ssh-agent`

I now see that it is a two step process, first the backticks cause ssh-agent to 
be run, producing 3 lines of output.

Then, in accordance with the explanation of eval I read in man bash, those 
three lines of output are concatenated and evaluated (executed).

At first I hadn't noticed that those were backticks, I assumed, without looking 
closely, that they were single quotes.

Then, in accordance with my vague recollection of what I think of as Greg 
Woolidge's typical advice (which I (may mis-)remember as "always quote"), I 
thought the backticks (that I incorrectly saw as single quotes) were just the 
"proper" way to specify a command to be eval'ed.  

For posterity, here is what man bash says:

<quote>
eval [arg ...]
       The  args  are read and concatenated together into a single command.  
This command is then read and executed by the shell, and its exit status  is  
returned  as  the value of eval.  If there are no args, or only null 
arguments, eval returns 0.
<\quote>

Another part of my misunderstanding stemmed from seeing only one command on 
that line, and wondering what had to be concatenated.  (Now I get it.)

Nothing new below this line -- in fact, almost all deleted:

On Friday, June 10, 2022 11:59:42 AM The Wanderer wrote:
> On 2022-06-10 at 11:25, rhkramer@gmail.com wrote:


Reply to: