title: AWK - Transmission of a variable with getline to system ()?
body: <p>I have a theoretical question:</p>
  
  <p>1) How pass a variable to the system of getline ()?</p>
  
  <pre><code>awk 'BEGIN{var="ls"; var | getline var; system("echo $var")}'
  </code></pre>
  
  <p>2) How to assign a variable the output system ("ls") and print the result in awk?</p>
  
  <pre><code>awk 'BEGIN{var="system("ls")"; print '$var'}'
  </code></pre>
  
  <p>3) Can you assign a variable in the system (var = "ls") and print the result in awk?</p>
  
  <pre><code>awk 'BEGIN{system(var="ls"); print "'"$var"'"}'
  </code></pre>
  
  <p>Thank you for the information.</p>
  
  <p><strong>EDIT:</strong> </p>
  
  <p><strong>torek</strong>: Thank you for your response.</p>
  
  <p>I understand that in the first example, you can do this:</p>
  
  <pre><code>awk 'BEGIN { while ("ls -l" | getline var) system("echo " var  );}'
  </code></pre>
  
  <p>For this application, you can not assign a variable output from system ()? As in this example:</p>
  
  <pre><code>awk 'BEGIN {var="ls -l"; system(var); print var}'
  </code></pre>