Remove the comment sign from the ‘export BW_SESSION=xxxx’ so we can write it to a source able file

Since I rely to the cli to implement autotype, I login to the cli a lot. After login we get a few lines on stdout. One of the contains the export BW_SESSION command, as a comment.
It would be so nice to be able to write this to a file so a script can source this and check the state before having to logon again.

Now we have to pick this line from the comments.

Seems like a quickie to me. The ssh-agent has similar output, making it possible to attach to the running agent again. For BW it looks like the BW_SESSION serves that goal. This tiny change improves usability and improves the workflow for cli users.

If you unlock your vault with a script, you can run the bw unlock command like this:

export BW_SESSION="$(bw unlock --raw)"

And if you need it written on a source able file, you can do it with a simple echo command.

2 Likes