Created
April 11, 2014 05:00
-
-
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
This file contains hidden or 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
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