ubuntu-manual-bugs team mailing list archive
Mailing list archive
[Bug 587848] Re: Incorrect shell code regarding tilde expansion
** Changed in: ubuntu-manual
Status: Confirmed => In Progress
Incorrect shell code regarding tilde expansion
You received this bug notification because you are a member of Ubuntu
Manual Bugs, which is subscribed to Ubuntu Manual.
Status in Ubuntu Manual: In Progress
In chapter 6, page 121 we find the following snippet
If there are spaces in one of the directories, you will need to put quotation
marks around the path:
$ cd "~/Music/The Beatles/Sgt. Pepper's Lonely Hearts Club Band/"
While the text is correct in stating that putting quotation marks around the path will allow the spaces to be treated as part of the path rather than as word separators, the tilde loses its meaning when quoted. I.e. try the following in a shell:
echo '~' "~" ~
See http://www.opengroup.org/onlinepubs/7990989775/xcu/chap2.html#tag_001_006_001 about the rules regarding tilde expansion in POSIX shells.
In short, the correct command-line should be:
$ cd ~/"Music/The Beatles/Sgt. Pepper's Lonely Hearts Club Band/"
$ cd "$HOME/Music/The Beatles/Sgt. Pepper's Lonely Hearts Club Band/"