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

@ -88,6 +88,10 @@ Get gzipped file size.
Test if HTTP compression (RFC 2616 + SDCH) is enabled for a given URL. Send a fake UA string for sites that sniff it instead of using the Accept-Encoding header.
### ssh-key
Copy public SSH key to clipboard. Generate it if necessary.
### add-ssh-host <username> <hostname> <identifier>
Create an SSH key and uploads it to the given host.

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() {