CLI - Trying to login with personal API key automatically using environment variables

I’m writing a bash script to automatically retrieve one of my passwords.

My plan is to login using the personal API key method, as detailed in the documentation found here: Personal API Key for CLI Authentication | Bitwarden Help Center

Because it’s a script, I don’t want to manually enter my client id and secret, so I am following the suggestion to set the environment variables BW_CLIENTID and BW_CLIENTSECRET.

However when I run the command bw login --apikey it still requests that I manually enter the client id and secret.

Could anyone help me to understand what’s going wrong?

Never mind, I figured it out. I misunderstood how bash treats environment variables.

This is the command i needed:
BW_CLIENTID=$BW_CLIENTID BW_CLIENTSECRET=$BW_CLIENTSECRET bw login --apikey

Hey, when I try to login with the api key, it still asks me for my master password. Is this intended?