title: How to pass file path to a function as an argument in bash script?
body: <p>I want to take file from different directory and pass it to a function as an argument. I have been at this for hours but I can not get it to work. So far I have tried this </p>
  
  <pre><code>#!/bin/bash
  
  myfile=/home/$USER/Desktop/Programs/Files/asd.bam
  
   function mate()
  { 
      samtools index $arg
  
      echo "$arg"
   }
  
  mate $myfile
  </code></pre>
  
  <p>I check argument with echo command but It shows empty.</p>
  
  <p>Thanks in advance.</p>