I'm following this guide on how to set up passwordless SSH authentication with ssh-agent.
To start up ssh-agent the author recommends the following code in .bash_profile
:
SSHAGENT=/usr/bin/ssh-agent
SSHAGENTARGS="-s"
if [ -z "$SSH_AUTH_SOCK" -a -x "$SSHAGENT" ]; then
eval `$SSHAGENT $SSHAGENTARGS`
trap "kill $SSH_AGENT_PID" 0
fi
I don't understand why it is trapping signal 0. According to man 7 signal there is no such signal.
Is this just a typo or bug or does this really achieve something?
0
in a shelltrap
command. When sending a signal withkill
, a signal number of 0 means not to send a signal after all; this is a way of testing the existence of the target process. – Gilles 'SO- stop being evil' Jul 24 '11 at 14:00trap -l
! – amphetamachine Jul 25 '11 at 08:59