<p>I currently have something like this in my kubeconfig</p>
<pre><code> exec:
      apiVersion: client.authentication.k8s.io/v1
      command: PATH_DETERMINED_VIA_BINARY/token_generator
      args:
        - --ACCESS_TOKEN
      interactiveMode: Never
      provideClusterInfo: false
</code></pre>
<p>My question is , in the above the PATH_DETERMINED_VIA_BINARY is obtained by running a binary called <code>tginfo</code> like this</p>
<pre><code>sudo tginfo path token --&gt; This will return a path (like usr/lib/000012/)
</code></pre>
<p>Now this is the path that will contain the binary <code>token_generator</code> that is used in the command above. My question is how do I call <code>tginfo</code> binary to obtain a part of the path that will be used in the command ?</p>

James Franco
<p>How I understand the problem is that
you want the output of one command to run as part of another command. In Linux you can use backticks (`) for this. e.g if you want to loop through the item in a particular location. You would do:</p>
<pre><code>for i in `ls`;…
</code></pre>
<p>So in theory something like this will work. The sudo tginfo command is inside backticks so that should get evaluated first followed by its output combined with the rest of the string.</p>
<p>Also look into eval. If this doesn’t work.</p>
<pre><code> exec:
      apiVersion: client.authentication.k8s.io/v1
    command: [&quot;/bin/sh&quot;]
    args:  [&quot;-c&quot;, &quot;`sudo tginfo path token`/token_generator --ACCESS_TOKEN&quot;]
      interactiveMode: Never
      provideClusterInfo: false
</code></pre>
