Skip to content

Instantly share code, notes, and snippets.

View diegows's full-sized avatar
🏡
Working from home!

Diego Woitasen diegows

🏡
Working from home!
View GitHub Profile
@diegows
diegows / ssh-agent
Last active December 21, 2015 04:49 — forked from rezlam/ssh-agent
pgrep is better for this job. ps ax | grep ssh-agent founds the grep itself and fails.
SSH_ENV="$HOME/.ssh/environment"
# start the ssh-agent
function start_agent {
echo "Initializing new SSH agent..."
# spawn ssh-agent
ssh-agent | sed 's/^echo/#echo/' > "$SSH_ENV"
echo succeeded
chmod 600 "$SSH_ENV"
. "$SSH_ENV" > /dev/null