Created
February 12, 2017 01:06
-
-
Save lykranian/e04d44ba2f823e6b296c98ded366b809 to your computer and use it in GitHub Desktop.
little script showing how to get current keybase user
This file contains 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 | |
# little script showing how to get current keybase user | |
# check if installed | |
installed () { | |
type "$1" &> /dev/null | |
} | |
if ! installed keybase; then | |
echo "please install keybase." | |
exit | |
fi | |
# check if logged in | |
LOGGED_IN_=$(keybase status | grep "Logged in") | |
LOGGED_IN="${LOGGED_IN_##* }" | |
if [ "$LOGGED_IN" != "yes" ]; then | |
echo 'you are not logged into keybase. see `run_keybase`' | |
exit | |
fi | |
# finally get to here | |
USER_=$(keybase status | grep Username) | |
USER="${USER_##* }" | |
# echo the user | |
echo $USER |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment