Skip to main content
October 3, 2022
Question

cli 2.7.1 run command with arguments

  • October 3, 2022
  • 3 replies
  • 339 views

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:https://1password.community/search?Search=run%20with%20arguments

3 replies

1Password Employee
October 14, 2022

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

br8dyAuthor
October 14, 2022

@andi_t_1P That makes sense and worked great! Thanks for the help

1Password Employee
October 17, 2022

Great, glad it worked out!