Skip to content

Instantly share code, notes, and snippets.

@arkadius
Created September 26, 2016 11:43
Show Gist options
  • Save arkadius/a2ca676441152e3d219984f6c6904a18 to your computer and use it in GitHub Desktop.
Save arkadius/a2ca676441152e3d219984f6c6904a18 to your computer and use it in GitHub Desktop.
#!/bin/bash
host=$1
password=`awk "/#Password/ && inhost { print \\\$2 } /Host/ { inhost=0 } /Host $host/ { inhost=1 }" ~/.ssh/config`
if [[ -z "$password" ]]; then
/usr/bin/ssh $*
else
sshpass -p $password /usr/bin/ssh $*
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment