Last active
January 10, 2017 00:42
-
-
Save cbguder/960170904443a5d66ffb2c315e2cc158 to your computer and use it in GitHub Desktop.
Add SSH keys
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
set -e | |
LOCATION=$(cd `dirname $0`; pwd) | |
VOLUME=$(df -P $0 | awk 'NR!=1 {print $NF}') | |
DURATION="$1" | |
if [ -z "$DURATION" ]; then | |
NOW=$(date +%s) | |
THEN=$(date -j 1705 +%s) | |
DURATION=$(($THEN-$NOW)) | |
fi | |
ssh-add -t "$DURATION" "${LOCATION}/id_rsa" | |
diskutil umount force "$VOLUME" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment