Skip to content

Instantly share code, notes, and snippets.

@cbguder
Last active January 10, 2017 00:42
Show Gist options
  • Save cbguder/960170904443a5d66ffb2c315e2cc158 to your computer and use it in GitHub Desktop.
Save cbguder/960170904443a5d66ffb2c315e2cc158 to your computer and use it in GitHub Desktop.
Add SSH keys
#!/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