dotfiles/.local/bin/scripts/genssh

12 lines
357 B
Plaintext
Raw Normal View History

2021-03-23 20:55:02 +00:00
#!/bin/sh
keys="$HOME/.ssh/keys"
name="${1:-id_rsa}"
mkdir -p "$keys"
test -f "$keys/$name.pub" || ssh-keygen -t rsa -b 4096 -f "$keys/$name" -q -N ""
cat "$keys/$name.pub"
if test "$OSTYPE" = "cygwin"
then cat "$keys/$name.pub">/dev/clipboard
else xclip -sel clip 2>/dev/null <"$keys/$name.pub"
fi && echo "SSH Public key copied to clipboard" || return 0