Signing back into the Community for the first time? You'll need to reset your password to access your account.  Find out more.

Forum Discussion

br8dy's avatar
br8dy
New Contributor
3 years ago

cli 2.7.1 run command with arguments

I'm no able to pass a variable value as a parameter to a op run command.

Example script:

export TOKEN="op://correct/refernece/path"
op run --no-masking -- terminus auth:login --email example@email.com --machine-token TOKEN

It seems like the parameters are getting ignored. Manually passing the token value does complete. I also get the correct value printed when trying the example script provided in the documentation

op run --no-masking -- printenv TOKEN


1Password Version: Not Provided
Extension Version: Not Provided
OS Version: Not Provided
Browser:_ Not Provided
Referrer: forum-search:run with arguments

  • andi_t_1P's avatar
    andi_t_1P
    Icon for 1Password Team rank1Password Team

    Hi br8dy , please do try op run --no-masking -- sh -c 'terminus auth:login --email example@email.com --machine-token $TOKEN'. This will work as expected. What is happening in your case I believe is that the TOKEN gets evaluated before the terminus command is executed as a subprocess of op run. I will make sure we update the documentation to reflect this unintuitive use case.

    All the best,
    Andi