Skip to content

Instantly share code, notes, and snippets.

@amitittyerah
Created April 11, 2014 05:00
Show Gist options
  • Save amitittyerah/10441635 to your computer and use it in GitHub Desktop.
Save amitittyerah/10441635 to your computer and use it in GitHub Desktop.
Bash profile function to read the SSH config and to copy it to the clipboard
function config()
{
cat ~/.ssh/config | while read line; do
if [[ $line == Host* ]];then
lline=$(echo $line| tr '[:upper:]' '[:lower:]')
if [ $# -eq 0 ];then
echo "$line"
echo "ssh ${line:5}" | pbcopy
elif [[ "${lline}" == *"$1"* ]];then
echo "$line"
echo "ssh ${line:5}" | pbcopy
fi
fi
done
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment