Run ln -s ../shared/app.conf config/current.conf where config and shared are sibling directories.
./config/
./shared/app.confWhat does current.conf refer to?
A relative symbolic-link target is resolved from the directory containing the link. ../shared therefore reaches the sibling shared directory.
Detailed explanation
Incorrect. The process current directory is not the base for a relative symlink.
Incorrect. The target begins with .. and leaves config.
Correct. From config, ../shared/app.conf is the sibling path.
Incorrect. The target is relative, not an absolute /shared path.
Try it yourself
An example you can run in a temporary verification environment.
tmp=$(mktemp -d); mkdir "$tmp/config" "$tmp/shared"; printf ok >"$tmp/shared/app.conf"; (cd "$tmp" && ln -s ../shared/app.conf config/current.conf); cat "$tmp/config/current.conf"; rm -rf "$tmp"Expected result
okKey points
- Relative target
- The link's parent is the base
- Moving the link can change resolution
Notes
- Environment: Linux / POSIX path resolution / 一時ディレクトリ
- Use disposable files and directories for link experiments.
- Link behavior can differ for special filesystem objects and cross-filesystem operations.
Foundation review
Place the operation
The stored `../shared/app.conf` is interpreted from `config/`, which reaches the sibling `shared/` directory.
Check the side effect
Move the link and observe that a relative target may no longer resolve to the original object.