readlink
: Print value of a symlink or canonical file namereadlink
may work in one of two supported modes:
readlink
outputs the value of the given symbolic links.
If readlink
is invoked with an argument other than the name
of a symbolic link, it produces no output and exits with a nonzero exit code.
readlink
outputs the absolute name of the given files which contain
no ., .. components nor any repeated separators
(/) or symbolic links. The realpath
command is the
preferred command to use for canonicalization. See realpath
: Print the resolved file name..
readlink [option]… file…
By default, readlink
operates in readlink mode.
The program accepts the following options. Also see Common options.
Activate canonicalize mode.
If any component of the file name except the last one is missing or unavailable,
readlink
produces no output and exits with a nonzero exit
code. A trailing slash is ignored.
Activate canonicalize mode.
If any component is missing or unavailable, readlink
produces
no output and exits with a nonzero exit code. A trailing slash
requires that the name resolve to a directory.
Activate canonicalize mode.
If any component is missing or unavailable, readlink
treats it
as a directory.
Do not print the output delimiter, when a single file is specified. Print a warning if specified along with multiple files.
Suppress most error messages. On by default.
Report error messages.
Output a zero byte (ASCII NUL) at the end of each line, rather than a newline. This option enables other programs to parse the output even when that output would contain data with embedded newlines.
The readlink
utility first appeared in OpenBSD 2.1.
The realpath
command without options, operates like
readlink
in canonicalize mode.
An exit status of zero indicates success, and a nonzero value indicates failure.