#!/bin/bash # To unlock and set session vars for bitwarden vault unset BWPASSWORD prompt="Enter Bitwarden Master Password: " while IFS= read -p "$prompt" -r -s -n 1 char do if [[ $char == $'\0' ]] then break fi prompt='*' BWPASSWORD+="$char" done echo export BW_SESSION="$(bw unlock $BWPASSWORD --raw)" echo "Bitwarden vault unlocked, session variable set" echo unset BWPASSWORD