title: Why is the following bash script not working when called with nohup?
body: <p>A script like the following:</p>
  
  <pre><code>#!/bin/bash
  
  function hello {
  
          echo "Hello World"
  
  }
  
  hello
  </code></pre>
  
  <p>will work fine but when I call it with <a href="http://en.wikipedia.org/wiki/Nohup" rel="nofollow">nohup</a></p>
  
  <pre><code>nohup ./myScript.sh 
  </code></pre>
  
  <p>the script no longer works and the following is printed:</p>
  
  <pre><code>./myScript.sh: 5: ./myScript.sh: function: not found
  Hello World
  ./myScript.sh: 9: ./myScript.sh: Syntax error: "}" unexpected
  </code></pre>
  
  <p>I know that there is no point in using <code>nohup</code> for this script since it runs fairly quick but I have another script that is going to take several hours to run and I have used that function syntax in it. Is there a way to fix this?</p>