/opt/app/current is a symbolic link containing the relative target releases/v2.
Determine the base used to resolve the target.
What target is resolved?
A relative path stored in a symbolic link is resolved relative to the directory containing the link, not the process's current working directory.
Detailed explanation
Incorrect. The process current working directory is not the base for a relative symlink target.
Incorrect. The process current working directory is not the base for a relative symlink target.
Incorrect. The leading slash would make the path absolute and is not stored here.
Incorrect. The leading slash would make the path absolute and is not stored here.
Incorrect. This omits the app directory that contains the link.
Incorrect. This omits the app directory that contains the link.
Correct. /opt/app plus releases/v2 resolves to /opt/app/releases/v2.
Correct. /opt/app plus releases/v2 resolves to /opt/app/releases/v2.
Try it yourself
An example you can run in a temporary verification environment.
readlink /opt/app/currentExpected result
リンクに格納された相対文字列releases/v2を表示するKey points
- The link's parent is the base
- It is not based on cwd
- Distinguish stored text from resolved path
Notes
- Environment: GNU coreutils 9.x/Linux
- Command output formatting can vary slightly by distribution or tool version.
- Run the example in a temporary directory or process when possible.
Foundation review
Read the scope first
Check whether the command acts on the current shell, a new process, an existing process, or a file.
Verify the observable result
Use the supplied command and compare the output with the expected result.