Search code examples
bashexpansiontildehome-directory

home directory expansion (~) within an argument


When I enter the following (BASH):

rdesktop -r disk:bacon=~/bacon host

It does not expand to

rdesktop -r disk:bacon=/home/me/bacon host

It seems the "disk:" part is the problem as can be seen in:

$ echo bacon=~/bacon disk:bacon=~/bacon

bacon=/home/me/bacon disk:bacon=~/bacon

How can I make tilde expand?


Solution

  • While ~ does not expand (it's used as specially routed of the path), $HOME does.

    rdesktop -r disk:bacon=$HOME/bacon host
    

    But be careful with environment-changing su!