xref: /minix3/usr.bin/basename/basename.1 (revision 0b8a9e801d87951bf6562d7043594da801f85a64)
1*0b8a9e80SLionel Sambuc.\"	$NetBSD: basename.1,v 1.17 2003/09/06 20:56:40 kleink Exp $
2*0b8a9e80SLionel Sambuc.\"
3*0b8a9e80SLionel Sambuc.\" Copyright (c) 1990, 1993, 1994
4*0b8a9e80SLionel Sambuc.\"	The Regents of the University of California.  All rights reserved.
5*0b8a9e80SLionel Sambuc.\"
6*0b8a9e80SLionel Sambuc.\" This code is derived from software contributed to Berkeley by
7*0b8a9e80SLionel Sambuc.\" the Institute of Electrical and Electronics Engineers, Inc.
8*0b8a9e80SLionel Sambuc.\"
9*0b8a9e80SLionel Sambuc.\" Redistribution and use in source and binary forms, with or without
10*0b8a9e80SLionel Sambuc.\" modification, are permitted provided that the following conditions
11*0b8a9e80SLionel Sambuc.\" are met:
12*0b8a9e80SLionel Sambuc.\" 1. Redistributions of source code must retain the above copyright
13*0b8a9e80SLionel Sambuc.\"    notice, this list of conditions and the following disclaimer.
14*0b8a9e80SLionel Sambuc.\" 2. Redistributions in binary form must reproduce the above copyright
15*0b8a9e80SLionel Sambuc.\"    notice, this list of conditions and the following disclaimer in the
16*0b8a9e80SLionel Sambuc.\"    documentation and/or other materials provided with the distribution.
17*0b8a9e80SLionel Sambuc.\" 3. Neither the name of the University nor the names of its contributors
18*0b8a9e80SLionel Sambuc.\"    may be used to endorse or promote products derived from this software
19*0b8a9e80SLionel Sambuc.\"    without specific prior written permission.
20*0b8a9e80SLionel Sambuc.\"
21*0b8a9e80SLionel Sambuc.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
22*0b8a9e80SLionel Sambuc.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
23*0b8a9e80SLionel Sambuc.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
24*0b8a9e80SLionel Sambuc.\" ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
25*0b8a9e80SLionel Sambuc.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
26*0b8a9e80SLionel Sambuc.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
27*0b8a9e80SLionel Sambuc.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
28*0b8a9e80SLionel Sambuc.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
29*0b8a9e80SLionel Sambuc.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
30*0b8a9e80SLionel Sambuc.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
31*0b8a9e80SLionel Sambuc.\" SUCH DAMAGE.
32*0b8a9e80SLionel Sambuc.\"
33*0b8a9e80SLionel Sambuc.\"     @(#)basename.1	8.2 (Berkeley) 4/18/94
34*0b8a9e80SLionel Sambuc.\"
35*0b8a9e80SLionel Sambuc.Dd April 18, 1994
36*0b8a9e80SLionel Sambuc.Dt BASENAME 1
37*0b8a9e80SLionel Sambuc.Os
38*0b8a9e80SLionel Sambuc.Sh NAME
39*0b8a9e80SLionel Sambuc.Nm basename ,
40*0b8a9e80SLionel Sambuc.Nm dirname
41*0b8a9e80SLionel Sambuc.Nd return filename or directory portion of pathname
42*0b8a9e80SLionel Sambuc.Sh SYNOPSIS
43*0b8a9e80SLionel Sambuc.Nm
44*0b8a9e80SLionel Sambuc.Ar string
45*0b8a9e80SLionel Sambuc.Op Ar suffix
46*0b8a9e80SLionel Sambuc.Nm dirname
47*0b8a9e80SLionel Sambuc.Ar string
48*0b8a9e80SLionel Sambuc.Sh DESCRIPTION
49*0b8a9e80SLionel Sambuc.Nm
50*0b8a9e80SLionel Sambucdeletes any prefix ending with the last slash
51*0b8a9e80SLionel Sambuc.Ql \&/
52*0b8a9e80SLionel Sambuccharacter present in
53*0b8a9e80SLionel Sambuc.Ar string ,
54*0b8a9e80SLionel Sambucand a
55*0b8a9e80SLionel Sambuc.Ar suffix ,
56*0b8a9e80SLionel Sambucif given.
57*0b8a9e80SLionel SambucThe resulting filename is written to the standard output.
58*0b8a9e80SLionel SambucA non-existent suffix is ignored.
59*0b8a9e80SLionel Sambuc.Pp
60*0b8a9e80SLionel Sambuc.Nm dirname
61*0b8a9e80SLionel Sambucdeletes the filename portion, beginning
62*0b8a9e80SLionel Sambucwith the last slash
63*0b8a9e80SLionel Sambuc.Ql \&/
64*0b8a9e80SLionel Sambuccharacter to the end of
65*0b8a9e80SLionel Sambuc.Ar string ,
66*0b8a9e80SLionel Sambucand writes the result to the standard output.
67*0b8a9e80SLionel Sambuc.Sh EXIT STATUS
68*0b8a9e80SLionel SambucBoth the
69*0b8a9e80SLionel Sambuc.Nm
70*0b8a9e80SLionel Sambucand
71*0b8a9e80SLionel Sambuc.Nm dirname
72*0b8a9e80SLionel Sambucutilities
73*0b8a9e80SLionel Sambucexit 0 on success, and \*[Gt]0 if an error occurs.
74*0b8a9e80SLionel Sambuc.Sh EXAMPLES
75*0b8a9e80SLionel SambucThe following line sets the shell variable
76*0b8a9e80SLionel Sambuc.Ev FOO
77*0b8a9e80SLionel Sambucto
78*0b8a9e80SLionel Sambuc.Pa /usr/bin .
79*0b8a9e80SLionel Sambuc.Pp
80*0b8a9e80SLionel Sambuc.Dl FOO=`dirname /usr/bin/trail`
81*0b8a9e80SLionel Sambuc.Sh SEE ALSO
82*0b8a9e80SLionel Sambuc.Xr csh 1 ,
83*0b8a9e80SLionel Sambuc.Xr sh 1 ,
84*0b8a9e80SLionel Sambuc.Xr basename 3 ,
85*0b8a9e80SLionel Sambuc.Xr dirname 3
86*0b8a9e80SLionel Sambuc.Sh STANDARDS
87*0b8a9e80SLionel SambucThe
88*0b8a9e80SLionel Sambuc.Nm
89*0b8a9e80SLionel Sambucand
90*0b8a9e80SLionel Sambuc.Nm dirname
91*0b8a9e80SLionel Sambucutilities conform to
92*0b8a9e80SLionel Sambuc.St -p1003.2-92 .
93