dotfiles

My personal shell configs and stuff
git clone git://git.alex.balgavy.eu/dotfiles.git
Log | Files | Refs | Submodules | README | LICENSE

bwu (412B)


      1 #!/bin/sh
      2 command -v bw 1>/dev/null 2>&1 || { printf "Bitwarden CLI not installed.\n" && exit 1; }
      3 [ -n "$BW_SESHFILE" ] || { printf "Set BW_SESHFILE in your env.\n" && exit 1; }
      4 if ! [ -f "$BW_SESHFILE" ]; then
      5   touch "$BW_SESHFILE"
      6   chmod 600 "$BW_SESHFILE"
      7   { bw unlock --raw > "$BW_SESHFILE" \
      8     && printf "Vault unlocked.\n"; } \
      9     || rm "$BW_SESHFILE";
     10 else
     11   printf "Session already active.\n"
     12 fi
     13