title: Calling function in bash/Shell Script
body: <p>When I am calling function in shell script like it's not working</p>
  
  <pre><code>testfunction
  </code></pre>
  
  <p>but if I call function like below it's working</p>
  
  <pre><code>$(testfunction);
  </code></pre>
  
  <p>Any thoughts? I am running bash shell on Ubuntu</p>
  
  <p>Thank you,
  Sambhav</p>
  
  <p>Hi All, Here is a sample script and function decl. and call. As mentioned in the question the funcation call - function is not working but $(function is working) </p>
  
  <pre><code>#!/bin/bash 
  TITLE=My Title"; 
  ########FUNCTIONS 
  ### Function Declaration 
  test() { echo "echoing test"; } 
  cat &lt;&lt; EOF &lt;html&gt; &lt;head&gt; &lt;TITLE&gt;"$TITLE"&lt;/TITLE&gt;
  &lt;/head&gt;
  &lt;/body&gt; 
  ### Calling the function here - Not working test 
  #### The Below function call is working $(test) 
  &lt;/body&gt; 
  &lt;/html&gt; 
  EOF 
  </code></pre>