Recently I find I can't use cd - to go back to last directory sometimes. It gives the error of -bash: cd: ~/whatever_dir: No such file or directory. A closer look shows that the error only happens if the last directory contains tilde. It seems tilde cannot be expanded. "cd ~", however, can successfully change to my home directory. What's the problem? I know tilde won't expand inside quotes, but the last directory stored is not in qotes when executing cd -, right? Plus, cd - worked for me previously.
|
| |||
|
feedback
|
migrated from stackoverflow.com Dec 17 '11 at 11:33
This question came from our site for professional and enthusiast programmers.
|
The likely source of the problem, executed as part of
Stop reassigning | |||
|
feedback
|
|
You have a serious bug in your shell which you should report. You said that in such a situation, Here is what I have here:
| |||
|
feedback
|
$OLDPWDwhen this phenomenon appears? – fge Dec 16 '11 at 22:08echo "$OLDPWD", notecho $OLDPWD– Keith Thompson Dec 16 '11 at 22:14echo– fge Dec 16 '11 at 22:27echocommands show~/whatever_dircorrectly. – RNAer Dec 17 '11 at 3:24