Skip to main content
Oct 3, 2022 1:11 AM UTC
Question

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

3 replies

1Password Employee
Oct 14, 2022 12:24 PM UTC

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
Oct 14, 2022 2:32 PM UTC

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

1Password Employee
Oct 17, 2022 9:33 AM UTC

Great, glad it worked out!