don't open target for writing if we're just verifying the tapes
[unix-history] / usr / src / usr.bin / basename / basename.1
CommitLineData
9971923e 1.\" @(#)basename.1 6.2 (Berkeley) %G%
801033a1 2.\"
e9f461a9 3.TH BASENAME 1 ""
801033a1
KM
4.AT 3
5.SH NAME
9971923e 6basename, dirname \- strip filename affixes
801033a1 7.SH SYNOPSIS
9971923e
KB
8\fBbasename\fP \fBstring\fP [ \fBsuffix\fP ]
9.br
10\fBdirname\fP \fBstring\fP
801033a1 11.SH DESCRIPTION
9971923e
KB
12\fIBasename\fP deletes any prefix ending in `/' and the \fIsuffix\fP,
13if present in \fIstring\fP, from \fIstring\fP, and prints the result
14to the standard output. It is normally used inside substitution marks
15(\`\`) in shell procedures.
801033a1 16.PP
9971923e
KB
17\fIDirname\fP deletes from the last slash (``/'') to the end of
18\fIstring\fP, and prints to result to the standard output.
19.SH EXAMPLES
20This shell procedure invoked with the argument \fI/usr/src/bin/cat.c\fP
21compiles the named file and moves the output to \fIcat\fP in the current
22directory:
801033a1
KM
23.IP "" 15n
24cc $1
25.br
26mv a.out \`basename $1 .c\`
9971923e
KB
27.PP
28The following line sets the shell variable \fIFOO\fP to \fI/usr/bin\fP.
29.IP "" 15n
30FOO=`dirname /usr/bin/trail`
801033a1
KM
31.SH "SEE ALSO"
32sh(1)