aboutsummaryrefslogtreecommitdiff
path: root/ssh-pubkey
blob: dadb1c399d375a7213330dbc2cb1521bad4a217e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
#!/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>"
  echo "available keys:"
  echo ""
  ( cd $HOME/.ssh/keys && find -name '*.pub' ) | grep -v decomissioned | sed -e 's/^/\t/'
  exit 1
elif [ ! -e "$HOME/.ssh/keys/$TYPE/$HANDLE" ]; then
  echo "$BASENAME: file not found: $HOME/.ssh/keys/$TYPE/$HANDLE"
  exit 1
fi

# Dispatch
cat $HOME/.ssh/keys/$TYPE/$HANDLE.pub