#!/bin/bash # Function to check if Bitwarden CLI is installed is_bw_installed() { command -v bw >/dev/null 2>&1 } # Function to unlock the Bitwarden vault unlock_vault() { echo "Unlocking Bitwarden vault..." BW_SESSION=$(bw unlock --raw) export BW_SESSION if [ -n "$BW_SESSION" ]; then echo "Vault unlocked successfully." bw sync else echo "Failed to unlock vault." fi } # Check if Bitwarden CLI is installed if is_bw_installed; then unlock_vault else echo "Bitwarden CLI is not installed, doing nothing." fi