によるとhelp cd
、
Options:
-L force symbolic links to be followed: resolve symbolic
links in DIR after processing instances of `..'
-P use the physical directory structure without following
symbolic links: resolve symbolic links in DIR before
processing instances of `..'
つまり、論理構造-L
を使用することを意味しますが、実際には物理的なディレクトリ構造を使用します。-P
論理構造はこんな感じです。
$ tree a
a
└── b
└── symlink -> ..
実際に行った時の物理的な構造a/b/symlink
は、
a
real を使用する場合は..
、次も使用する必要がありますcd -P
。
The -P option says to use the physical directory
structure instead of following symbolic links (see
also the -P option to the set builtin command);
the -L option forces symbolic links to be followed.
例、
$ cd
$ cd a/b/symlink # physical location is at a/
$ cd .. # now is at a/b
$ cd symlink # goes back to a/b/symlink
$ cd -P .. # follow physical path (resolve all symlinks)
$ pwd -P # -P is optional here to show effect of cd ..
/home/sarnold
$