xref: /netbsd-src/usr.bin/realpath/realpath.1 (revision d0aa7735ced28a7cd38de43316b787cdfa7046e8)
1*d0aa7735Swiz.\"	$NetBSD: realpath.1,v 1.3 2022/07/21 09:51:53 wiz Exp $
2771c4258Skamil.\"-
3771c4258Skamil.\" Copyright (c) 1990, 1993
4771c4258Skamil.\"	The Regents of the University of California.  All rights reserved.
5771c4258Skamil.\"
6771c4258Skamil.\" This code is derived from software contributed to Berkeley by
7771c4258Skamil.\" the Institute of Electrical and Electronics Engineers, Inc.
8771c4258Skamil.\"
9771c4258Skamil.\" Redistribution and use in source and binary forms, with or without
10771c4258Skamil.\" modification, are permitted provided that the following conditions
11771c4258Skamil.\" are met:
12771c4258Skamil.\" 1. Redistributions of source code must retain the above copyright
13771c4258Skamil.\"    notice, this list of conditions and the following disclaimer.
14771c4258Skamil.\" 2. Redistributions in binary form must reproduce the above copyright
15771c4258Skamil.\"    notice, this list of conditions and the following disclaimer in the
16771c4258Skamil.\"    documentation and/or other materials provided with the distribution.
17771c4258Skamil.\" 3. Neither the name of the University nor the names of its contributors
18771c4258Skamil.\"    may be used to endorse or promote products derived from this software
19771c4258Skamil.\"    without specific prior written permission.
20771c4258Skamil.\"
21771c4258Skamil.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
22771c4258Skamil.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
23771c4258Skamil.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
24771c4258Skamil.\" ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
25771c4258Skamil.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
26771c4258Skamil.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
27771c4258Skamil.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
28771c4258Skamil.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
29771c4258Skamil.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
30771c4258Skamil.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
31771c4258Skamil.\" SUCH DAMAGE.
32771c4258Skamil.\"
33771c4258Skamil.\"     @(#)pwd.1	8.2 (Berkeley) 4/28/95
34771c4258Skamil.\" From: src/bin/pwd/pwd.1,v 1.11 2000/11/20 11:39:39 ru Exp
35771c4258Skamil.\" $FreeBSD: head/bin/realpath/realpath.1 314436 2017-02-28 23:42:47Z imp $
36771c4258Skamil.\"
37245b5ea4Skre.Dd July 21, 2022
38771c4258Skamil.Dt REALPATH 1
39771c4258Skamil.Os
40771c4258Skamil.Sh NAME
41771c4258Skamil.Nm realpath
42245b5ea4Skre.Nd return resolved canonical path
43771c4258Skamil.Sh SYNOPSIS
44771c4258Skamil.Nm
45245b5ea4Skre.Op Fl eEq
46771c4258Skamil.Op Ar path ...
47771c4258Skamil.Sh DESCRIPTION
48771c4258SkamilThe
49771c4258Skamil.Nm
50771c4258Skamilutility uses the
51771c4258Skamil.Xr realpath 3
52771c4258Skamilfunction to resolve all symbolic links, extra
53771c4258Skamil.Ql /
54771c4258Skamilcharacters and references to
55771c4258Skamil.Pa /./
56771c4258Skamiland
57771c4258Skamil.Pa /../
58245b5ea4Skrein each
59245b5ea4Skre.Ar path ,
60245b5ea4Skreand writes the result of each to standard output
61245b5ea4Skrefollowed by a newline.
62771c4258SkamilIf
63771c4258Skamil.Ar path
64771c4258Skamilis absent, the current working directory
65771c4258Skamil.Pq Sq Pa .\&
66771c4258Skamilis assumed.
67771c4258Skamil.Pp
68245b5ea4SkreWith the
69245b5ea4Skre.Fl E
70245b5ea4Skreoption
71245b5ea4Skre(the default)
72245b5ea4Skreit is not an error for the final component
73245b5ea4Skreof the resolved pathname to reference a file
74245b5ea4Skrewhich does not exist.
75245b5ea4Skre.Pp
76245b5ea4SkreThe
77245b5ea4Skre.Fl e
78245b5ea4Skreoption reverses the effect of
79245b5ea4Skre.Fl E ,
80245b5ea4Skrerequiring the
81245b5ea4Skre.Ar path
82245b5ea4Skreto resolve to an existing pathname.
83245b5ea4Skre.Pp
84771c4258SkamilIf
85771c4258Skamil.Fl q
86771c4258Skamilis specified, warnings will not be printed when
87771c4258Skamil.Xr realpath 3
88771c4258Skamilfails.
89245b5ea4SkreMessages about other errors, such as bad usage, are still printed.
90245b5ea4Skre.Pp
91245b5ea4SkreOn error, nothing is written
92245b5ea4Skreto standard output for that
93245b5ea4Skre.Ar path .
94245b5ea4SkreIf
95245b5ea4Skre.Fl q
96245b5ea4Skrewas not given a diagnostic is written to standard error.
97771c4258Skamil.Sh EXIT STATUS
98771c4258Skamil.Ex -std
99245b5ea4SkreAny failure to resolve a
100245b5ea4Skre.Ar path
101245b5ea4Skreis an error for this purpose,
102245b5ea4Skrethe
103245b5ea4Skre.Fl q
104245b5ea4Skreoption is irrelevant.
105771c4258Skamil.Sh SEE ALSO
106*d0aa7735Swiz.Xr readlink 1 ,
107771c4258Skamil.Xr realpath 3
108245b5ea4Skre.Sh STANDARDS
109245b5ea4SkreThe
110245b5ea4Skre.Nm
111245b5ea4Skreutility is expected to comply with the forthcoming
112245b5ea4Skreedition of the POSIX standard.
113245b5ea4SkreTo be fully POSIX compliant, applications must use
114245b5ea4Skreeither the
115245b5ea4Skre.Fl e
116245b5ea4Skreor
117245b5ea4Skre.Fl E
118245b5ea4Skreoption, as which of those (if in fact either, and
119245b5ea4Skrenot some other behaviour) applies in their absence
120245b5ea4Skreis unspecified.
121245b5ea4SkreThe standard requires support for only a single, mandatory,
122245b5ea4Skre.Ar path
123245b5ea4Skreargument.
124771c4258Skamil.Sh HISTORY
125771c4258SkamilThe
126771c4258Skamil.Nm
127771c4258Skamilutility first appeared in
128771c4258Skamil.Fx 4.3
129771c4258Skamiland was imported into
130245b5ea4Skre.Nx 10 ,
131245b5ea4Skrebut modified to be slightly more compatible with the coreutils version,
132245b5ea4Skreand the proposed POSIX standard requirements.
133