Update bash_prompt
[config/bash.git] / .bash / aliases.d / ssh
1 #!/bin/bash
2
3 if command -v ssh &> /dev/null;
4 then
5   # Launch screen remotely via ssh and resume the remote session.
6   function ressh()
7   {
8     ssh -t "$@" screen -D -R
9   }
10 fi
11
12 if command -v ssh-agent &> /dev/null;
13 then
14   # Use ssh-agent.
15   #
16   # Assumes "$HOME/.ssh-agent" has been updated with the info from the
17   # running, agent, this can be done by using a user con job:
18   # @reboot ssh-agent -s | grep -v echo > $HOME/.ssh-agent
19
20   if [ -z "$SSH_CLIENT" ] && [ -e "$HOME/.ssh-agent" ];
21   then
22     . "$HOME/.ssh-agent"
23
24     alias keyon="ssh-add -t 10800"
25     alias keyoff='ssh-add -D'
26     alias keylist='ssh-add -l'
27   fi
28 fi