aboutsummaryrefslogtreecommitdiff
path: root/ssh-agent-loadkey
blob: 610f10b7ee51d85d3b7ca94a3704c1166fe83eec (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
#!/bin/bash
#
# Load a key into the ssh-agent
#

# Parameters
BASENAME="`basename $0`"
TYPE="$1"
HANDLE="$2"

# Check
if [ -z "$HANDLE" ]; then
  echo "usage: $BASENAME <keytype> <handle>"
  exit 1
elif [ ! -e "$HOME/.ssh/keys/$TYPE/$HANDLE" ]; then
  echo "$BASENAME: file not found: $HOME/.ssh/keys/$TYPE/$HANDLE"
  exit 1
fi

# Dispatch
ssh-add $HOME/.ssh/keys/$TYPE/$HANDLE