How to manually expand a special variable (ex: ~ tilde) in bash
问题 I have a variable in my bash script whose value is something like this: ~/a/b/c 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? How did I manage to pass this into my script without expansion? I passed the argument in surrounding it with double quotes. Try this