title: Assigning the output of a command to a variable
body: <p>I am new with unix and I am writing a shell script. </p>
  
  <p>When I run this line on the command prompt, it prints the total count of the number of processes which matches:</p>
  
  <pre><code>ps -ef | awk '/siebsvc –s siebsrvr/ &amp;&amp; !/awk/ { a++ } END { print a }'
  </code></pre>
  
  <p>example, the output of the above line is 2 in the command prompt. </p>
  
  <p>I want to write a shell script in which the output of the above line (2) is assigned to a variable, which will be later be used for comparison in an if statement. </p>
  
  <p>I am looking for something like</p>
  
  <pre><code>output= `ps -ef | awk '/siebsvc –s siebsrvr/ &amp;&amp; !/awk/ { a++ } END { print a }'`
  echo $output
  </code></pre>
  
  <p>But when i run it, it says output could not be found whereas I am expecting 2. Please help.</p>