That does not work for ssh/scp sessions. I usually test $PS1 to tell
> if it's really a shell -- the variable does not even exist for an
> scp session,
> although .bashrc gets called.
can you give us an example of what your .bashrc looks like?
Well, the whole thing is kinda long, but the part I was fooling with lately
now looks like this, and partly automates the use of ssh-agent for my
(very frequent) use of ssh from home to some machines at work. The
problem was probably either the "echo" commands or that this actually
proceeds within a subshell.
if [ "x" != "x$PS1" ] ; then
SHELL_LOGIN=1
else
# Probably scp; empty string is false
SHELL_LOGIN=
fi
if [ -n "$SHELL_LOGIN" ]
then
if [ -z "$SSH_AGENT_PID" ]
then
# not yet running in ssh-agent
ssh-agent /bin/bash
r=$?
echo Done with ssh-agent
sleep 1
exit $r
else
# this is an ssh-agent subshell
echo You may want to run ssh-add.
fi
fi
--
Kevin O'Gorman, PhD