12 lines
357 B
Plaintext
12 lines
357 B
Plaintext
|
#!/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
|
||
|
|