0

I have a code block with a shell scripts that asks for a token. I want to insert this token into the header-args, so that I can reference this from other code blocks.

I usually copy it, but can this be done with code?;)

1
  • Use :var token=foo where foo is the name of the code block that produces the token.
    – NickD
    Commented Jun 23, 2023 at 13:09

1 Answer 1

0

Something like this:

#+name: generate
#+begin_src shell 
  #generate-token
  echo "Super-secret-token-ABC"
#+end_src


#+name: use-token
#+begin_src shell :var token=generate
  echo command-that-needs-to-authenticate --token=${token}
#+end_src

#+RESULTS: use-token
: command-that-needs-to-authenticate --token=Super-secret-token-ABC
1
  • Did you see this? Did it work for you? I don't understand why you are so reluctant to provide feedback (accept, upvote, downvote, or even just a comment indicating the outcome). That's part of how this site is supposed to work.
    – NickD
    Commented Dec 19, 2023 at 22:01

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.