title: bash - supplying variable as a file path
body: <p>I'm trying to specify a variable for opening up a file with a particular app, but no matter how I attempt to reference it, it's not working.</p>
  
  <pre><code>sublime1=/Applications/Sublime\ Text.app/
  sublime2="/Applications/Sublime\ Text.app/"
  sublime3="/Applications/Sublime Text.app/"
  </code></pre>
  
  <p>I've been trying different ways of setting the variable, but for each of the variations I've tried, it fails.</p>
  
  <pre><code>open ~/.zshrc -a $sublime1
  open ~/.zshrc -a $sublime2
  open ~/.zshrc -a $sublime3
  </code></pre>
  
  <blockquote>
    <p>The file /Users/matthew/Text.app does not exist</p>
  </blockquote>
  
  <p>It gives me the same error for each, so I assume they're equivalent. Even when I try <code>cd $sublime</code> it also fails, but slightly differently... </p>
  
  <blockquote>
    <p>bash: cd: /Applications/Sublime: No such file or directory</p>
  </blockquote>
  
  <p><strong>Update</strong>:<br>
  It was suggested by <a href="https://stackoverflow.com/users/14122/charles-duffy">Charles</a> to use a function to accomplish the task of quickly opening something in sublime. </p>
  
  <pre><code>sublime() { open "$@" -a "/Applications/Sublime Text.app/"; }
  </code></pre>
  
  <p>Will allow you to simply run</p>
  
  <pre><code>sublime ~/.zshrc
  </code></pre>