Running ssh-agent from a shell script
Posted
by
Dan
on Server Fault
See other posts from Server Fault
or by Dan
Published on 2013-10-22T20:57:30Z
Indexed on
2013/10/22
21:56 UTC
Read the original article
Hit count: 406
I'm trying to create a shell script that, among other things, starts up ssh-agent and adds a private key to the agent. Example:
#!/bin/bash
# ...
ssh-agent $SHELL
ssh-add /path/to/key
# ...
The problem with this is ssh-agent apparently kicks off another instance of $SHELL (in my case, bash) and from the script's perspective it's executed everything and ssh-add and anything below it is never run.
How can I run ssh-agent from my shell script and keep it moving on down the list of commands?
© Server Fault or respective owner