Skip to content

Instantly share code, notes, and snippets.

@lykranian
Created February 12, 2017 01:06
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save lykranian/e04d44ba2f823e6b296c98ded366b809 to your computer and use it in GitHub Desktop.
Save lykranian/e04d44ba2f823e6b296c98ded366b809 to your computer and use it in GitHub Desktop.
little script showing how to get current keybase user
#!/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