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?
An unquoted tilde character (~) at the beginning of a word is expanded according to the following rules: ~ expands to the value of the HOME variable (the current user's home directory).
First check the provides argument is the directory or not using the if statement using the -d option for the first argument using the $1 parameter. If it is true then print the message that the provided argument is the directory. If the argument is not the directory then check it for the file.
Use the cd command to move to your home directory, and try the ls -l command.
The Linux home directory is a directory for a particular user of the system and consists of individual files. It is also referred to as the login directory. This is the first place that occurs after logging into a Linux system. It is automatically created as "/home" for each user in the directory'.
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
!
rdesktop -r disk:bacon=$(echo ~/bacon) host
will do it. It won't please the eye, but it will work.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With