|
|
1.1 root 1: .TH BASENAME 1
2: .CT 1 shell
3: .SH NAME
4: basename, dirname \- strip filename affixes
5: .SH SYNOPSIS
6: .B basename
7: .I string
8: [
9: .I suffix
10: ]
11: .PP
12: .B dirname
13: .I string
14: .SH DESCRIPTION
15: These functions split off useful parts of a pathname;
16: they are typically used inside substitution marks
17: .BR `\ `
18: in shell scripts.
19: .PP
20: .I Basename
21: deletes any prefix ending in
22: .L /
23: and the
24: .I suffix,
25: if present in
26: .I string,
27: from
28: .I string,
29: and prints the result on the standard output.
30: .PP
31: .I Dirname
32: places on standard output the name of the directory in which
33: a file named
34: .I string
35: would nominally be found.
36: The calculation is syntactic and independent of
37: the contents of the file system.
38: .SH EXAMPLES
39: .TP
40: .L
41: cc $1 -o `basename $1 .c`
42: Compile into
43: .LR file ,
44: where
45: .L $1
46: is
47: .L file.c
48: or
49: .LR dir/file.c .
50: .TP
51: .L
52: cc $1 -o `dirname $1`/`basename $1 .c`
53: Compile
54: .LR dir/file.c
55: into
56: .LR dir/file .
57: .SH "SEE ALSO"
58: .IR sh (1)
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.