title: Create bash script with osascript and passed var
body: <p>I haven't really done much in the way of bash scripts before so any help would be appreciated!</p>
  
  <p>I've added this function to my .bash_profile:</p>
  
  <pre><code>function test()
  {
      osascript -e 'tell app "System Events" to display dialog "$1"'
      echo "my name is $1"
  }
  </code></pre>
  
  <p>The second line works fine, however, the first line will just show $1 in the dialog. I have tried a few variations to that line as well as:</p>
  
  <pre><code>osascript &lt;&lt;EOD
    tell app "System Events" to display dialog "$1"
  EOD
  </code></pre>
  
  <p>Is there a certain way I need to concatenate <code>$1</code> on the osascript line, or is there a better way to do this?</p>