Some programs do not recognize tilde shortcut in filenames and expect full canonical paths, e.g.
/home/dave/myfile.txt instead of
Is there a way to make bash replace
~user by full canonical paths anytime a tilde is used?
When you run a command in the Bash shell, like:
the shell first makes the expansion of
But it's true, some programs don't interpret the
but this works insted:
But this behavior is masked by the Bash expansion, so you don't need any further interpretation.
Maybe it's obvious, but note that if a program uses a configuration files and expects some paths in it, it's not a Bash duty expand them.
Well, not sure about perl, but in bash script you can do that conversion with eval:
$dir will contain full path, i.e. /home/user/somedir at this point.