title: How to manually expand a special variable (ex: ~ tilde) in bash
body: <p>I have a variable in my bash script whose value is something like this:</p>
  
  <pre><code>~/a/b/c
  </code></pre>
  
  <p>Note that it is unexpanded tilde. When I do ls -lt on this variable (call it $VAR), I get no such directory. I want to let bash interpret/expand this variable without executing it. In other words, I want bash to run eval but not run the evaluated command. Is this possible in bash?</p>
  
  <p>How did I manage to pass this into my script without expansion? I passed the argument in surrounding it with double quotes.</p>
  
  <p>Try this command to see what I mean:</p>
  
  <pre><code>ls -lt "~"
  </code></pre>
  
  <p>This is exactly the situation I am in. I want the tilde to be expanded. In other words, what should I replace magic with to make these two commands identical:</p>
  
  <pre><code>ls -lt ~/abc/def/ghi
  </code></pre>
  
  <p>and</p>
  
  <pre><code>ls -lt $(magic "~/abc/def/ghi")
  </code></pre>
  
  <p>Note that ~/abc/def/ghi may or may not exist.</p>