0

What is the purpose we run ssh-agent with

eval `ssh-agent`

not just

ssh-agent

?

αғsнιη
  • 40,939
  • 15
  • 71
  • 114
Dims
  • 3,181
  • 9
  • 49
  • 107
  • 4
    Take a look at the output of `ssh_agent`. It's just output, and it doesn't change anything. In order for it to change something you need to execute the result, hence `eval`. Is that answering what you're asking? – roaima Dec 03 '20 at 11:40
  • @roaima ah, yes, I am an idiot, thanks :D – Dims Dec 03 '20 at 12:17
  • I don't see anything here that suggests you're an idiot. It was a reasonable question. (I'm now waiting for you to ask the follow-on, which is why `ssh-agent` can't make the changes itself... :-) – roaima Dec 03 '20 at 12:31
  • 1
    What the linked question doesn't explicitly explain is the point is to set environment for future processes spawned from an already running shell. `ssh-agent` process can only change its own environment or set environment for its child. There is no other way for it to change the environment of the current *shell* than to print commands and let the shell evaluate them. – Kamil Maciorowski Dec 03 '20 at 12:31
  • @roaima I confused two evaluations, one with quotes, another with `eval` command, it was real thinking mistake – Dims Dec 03 '20 at 12:49

0 Answers0