File:  [Research Unix] / researchv10dc / man / adm / man1 / basename.1
Revision 1.1.1.1 (vendor branch): download - view: text, annotated - select for diffs
Tue Apr 24 17:21:34 2018 UTC (8 years, 1 month ago) by root
Branches: belllabs, MAIN
CVS tags: researchv10, HEAD
researchv10 Dan Cross

.TH BASENAME 1 
.CT 1 shell
.SH NAME
basename, dirname \- strip filename affixes
.SH SYNOPSIS
.B basename
.I string
[
.I suffix
]
.PP
.B dirname
.I string
.SH DESCRIPTION
These functions split off useful parts of a pathname;
they are typically used inside substitution marks
.BR `\ `
in shell scripts.
.PP
.I Basename
deletes any prefix ending in 
.L /
and the
.I suffix,
if present in
.I string,
from
.I string,
and prints the result on the standard output.
.PP
.I Dirname
places on standard output the name of the directory in which
a file named
.I string
would nominally be found.
The calculation is syntactic and independent of
the contents of the file system.
.SH EXAMPLES
.TP
.L
cc $1 -o `basename $1 .c`
Compile into 
.LR file ,
where
.L $1
is
.L file.c
or
.LR dir/file.c .
.TP
.L
cc $1 -o `dirname $1`/`basename $1 .c`
Compile 
.LR dir/file.c
into
.LR dir/file .
.SH "SEE ALSO"
.IR sh (1)

unix.superglobalmegacorp.com

This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.