Skip to content

Instantly share code, notes, and snippets.

@babibn
Forked from ryanpcmcquen/bwpass
Created March 4, 2025 14:20
Show Gist options
  • Save babibn/490914aab6092b96bec038319ccf1e6d to your computer and use it in GitHub Desktop.
Save babibn/490914aab6092b96bec038319ccf1e6d 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