Line | |
---|
1 | .TH BASENAME 1
|
---|
2 | .SH NAME
|
---|
3 | basename, dirname \- strip off file prefixes and suffixes
|
---|
4 | .SH SYNOPSIS
|
---|
5 | \fBbasename \fIfile\fR [\fIsuffix\fR]\fR
|
---|
6 | .br
|
---|
7 | \fBdirname \fIfile\fR
|
---|
8 | .de FL
|
---|
9 | .TP
|
---|
10 | \\fB\\$1\\fR
|
---|
11 | \\$2
|
---|
12 | ..
|
---|
13 | .de EX
|
---|
14 | .TP 20
|
---|
15 | \\fB\\$1\\fR
|
---|
16 | # \\$2
|
---|
17 | ..
|
---|
18 | .SH EXAMPLES
|
---|
19 | .EX "basename /user/ast/file.c" "Strips path to yield \fIfile.c\fP"
|
---|
20 | .EX "basename /user/file.c .c" "Strips path and \fI.c\fP to yield \fIfile\fP"
|
---|
21 | .EX "dirname /user/file.c" "Strips basename to yield \fI/user\fP"
|
---|
22 | .SH DESCRIPTION
|
---|
23 | .PP
|
---|
24 | .I Basename
|
---|
25 | removes the initial directory names (if any) yielding the name of the
|
---|
26 | file itself.
|
---|
27 | If a second argument is present, it is interpreted as a suffix and is
|
---|
28 | also stripped, if present.
|
---|
29 | .PP
|
---|
30 | .I Dirname
|
---|
31 | removes the final component of a path, yielding the directory a file is in.
|
---|
32 | .PP
|
---|
33 | These programs are primarily used in shell scripts.
|
---|
Note:
See
TracBrowser
for help on using the repository browser.