Bash: ssh-key function.

This commit is contained in:
Artem Sapegin
2012-12-12 15:18:16 +04:00
parent cd087cd73a
commit c83b3a03a8
2 changed files with 15 additions and 0 deletions

View File

@ -80,6 +80,17 @@ function nyan() {
echo
}
# Copy public SSH key to clipboard. Generate it if necessary
ssh-key() {
file="$HOME/.ssh/id_rsa.pub"
if [ ! -f "$file" ]; then
ssh-keygen -t rsa
fi
cat "$file" | c
echo "Your public key copied to clipboard."
}
# Create an SSH key and uploads it to the given host
# Based on https://gist.github.com/1761938
add-ssh-host() {