Why does the eval
statement return
Illegal variable name
$ eval "$(ssh-agent -s)"
Illegal variable name.
Try $ eval "ssh-agent"
instead.
The correct command is
eval $(ssh-agent)
(no quotes!)
Background: ssh-agent
sends two lines of code to stdout
SSH_AUTH_SOCK=/tmp/ssh-xxxxxxxxx/agent.nnnn; export SSH_AUTH_SOCK;
SSH_AGENT_PID=22414; export SSH_AGENT_PID;
where /tmp/ssh-xxxxxxxx/agent.nnnn
is a file used as a socket to connect to the agent, and the second line contains the PID of the agent process.
$(command)
contains those two lines and eval
takes them and uses them to create/execute two commands
- result: you have two environment variables telling every process how to connect to the agent.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With