For some reason tilde expansion in Cygwin is not working for me at the prompt:
$ ls ~
ls: cannot access : No such file or directory
$ ls ~/bin
(lists /bin not $HOME/bin)
$ echo $HOME
/home/myusername
$ echo ~
$
In the last case there (echo ~
) there is no output (other than a couple of blank lines.)
I have set expand-tilde on
set in my $HOME/.inputrc
file. Is there something else I need configured?
This is a recurring problem with Cygwin that, I believe, was tied to some upgrade bug a while ago and never resolved.
In any case, the solution is simple: open /etc/passwd
in your favourite editor, and on the line with your username, between the fifth and sixth colons (the last and second-to-last), write in the correct path to your home directory, ie /home/myusername
.
The relevant line in my /etc/passwd
looks something like the below:
meand:unused:12345:54321:PCNAME\meand,S-1-5-21-4567891230-654987321-312456978-58252:/home/meand:/bin/screen