← Back to team overview

ubuntu-manual-bugs team mailing list archive

[Bug 587848] [NEW] Incorrect shell code regarding tilde expansion

 

Public bug reported:

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/"
or
$ cd "$HOME/Music/The Beatles/Sgt. Pepper's Lonely Hearts Club Band/"

** Affects: ubuntu-manual
     Importance: Undecided
         Status: New

-- 
Incorrect shell code regarding tilde expansion
https://bugs.launchpad.net/bugs/587848
You received this bug notification because you are a member of Ubuntu
Manual Bugs, which is subscribed to Ubuntu Manual.

Status in Ubuntu Manual: New

Bug description:
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/"
or
$ cd "$HOME/Music/The Beatles/Sgt. Pepper's Lonely Hearts Club Band/"





Follow ups

References