cli 2.7.1 run command with arguments

Options
br8dy
br8dy
Community Member

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

Comments

  • 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

  • br8dy
    br8dy
    Community Member
    Options

    @andi.t_1P That makes sense and worked great! Thanks for the help

  • Great, glad it worked out!

This discussion has been closed.