REALPATH(1) | General Commands Manual | REALPATH(1) |
realpath
— return
resolved canonical path
realpath |
[-eEq ] [path ...] |
The realpath
utility uses the
realpath(3) function to
resolve all symbolic links, extra ‘/
’
characters and references to /./ and
/../ in each path, and writes
the result of each to standard output followed by a newline. If
path is absent, the current working directory
(‘.’) is assumed.
With the -E
option (the default) it is not
an error for the final component of the resolved pathname to reference a
file which does not exist.
The -e
option reverses the effect of
-E
, requiring the path to
resolve to an existing pathname.
If -q
is specified, warnings will not be
printed when realpath(3)
fails. Messages about other errors, such as bad usage, are still
printed.
On error, nothing is written to standard output for that
path. If -q
was not given a
diagnostic is written to standard error.
The realpath
utility exits 0 on
success, and >0 if an error occurs. Any failure to resolve a
path is an error for this purpose, the
-q
option is irrelevant.
The realpath
utility is expected to comply
with the forthcoming edition of the POSIX standard. To be fully POSIX
compliant, applications must use either the -e
or
-E
option, as which of those (if in fact either, and
not some other behaviour) applies in their absence is unspecified. The
standard requires support for only a single, mandatory,
path argument.
The realpath
utility first appeared in
FreeBSD 4.3 and was imported into
NetBSD 10, but modified to be slightly more
compatible with the coreutils version, and the proposed POSIX standard
requirements.
July 21, 2022 | NetBSD 10.99 |