diff options
Diffstat (limited to 'ssh-pubkey')
-rwxr-xr-x | ssh-pubkey | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/ssh-pubkey b/ssh-pubkey new file mode 100755 index 0000000..dadb1c3 --- /dev/null +++ b/ssh-pubkey @@ -0,0 +1,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 |