Created
July 11, 2016 11:07
-
-
Save barend/a101b19a550d039faeabb55d9258860b to your computer and use it in GitHub Desktop.
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
#!/usr/bin/env bash | |
# Adds a bash function that grabs a password from the MacOS keychain. | |
# Usage: | |
# getFromKeychain <entryname> | |
getFromKeychain() { | |
echo $(security find-generic-password -ga "$1" 2>&1 >/dev/null | awk '/^password/{ print substr($2, 2, length($2) - 2) }') | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment