Skip to content

Instantly share code, notes, and snippets.

@ryanpcmcquen
Created March 10, 2020 23:32
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 ryanpcmcquen/7d3c8b7d78a3b4ca51ba6d5f487ab742 to your computer and use it in GitHub Desktop.
Save ryanpcmcquen/7d3c8b7d78a3b4ca51ba6d5f487ab742 to your computer and use it in GitHub Desktop.
Get passwords using the Bitwarden CLI.
#!/usr/bin/env bash
if [ "`echo ${1} | grep -i mongo`" ]; then
PASS=$(bw get item "${1}" | jq --join-output --raw-output .login.password | jq --slurp --raw-input '@uri' --raw-output)
else
PASS=$(bw get item "${1}" | jq --join-output --raw-output .login.password)
fi
echo ${PASS}
echo ${PASS} | pbcopy
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment