title: Returning a boolean from a Bash function
body: <p>I want to write a bash function that check if a file has certain properties and returns true or false. Then I can use it in my scripts in the "if". But what should I return?</p>
  
  <pre><code>function myfun(){ ... return 0; else return 1; fi;}
  </code></pre>
  
  <p>then I use it like this:</p>
  
  <pre><code>if myfun filename.txt; then ...
  </code></pre>
  
  <p>of course this doesn't work. How can this be accomplished?</p>