Skip to content

Commit 509f556

Browse files
committed
chapter: Command-Line Options
1 parent d94a884 commit 509f556

File tree

2 files changed

+157
-0
lines changed

2 files changed

+157
-0
lines changed

index.ptree

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -121,6 +121,7 @@ pages/bibliography.poly.pm
121121
pages/parsing_pathnames.poly.pm
122122
pages/exit_codes.poly.pm
123123
pages/io_redirection_de.poly.pm
124+
pages/command_line_opt.poly.pm
124125
}
125126

126127
}

pages/command_line_opt.poly.pm

Lines changed: 156 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,156 @@
1+
#lang pollen
2+
3+
◊page-init{}
4+
◊define-meta[page-title]{Command-Line Options}
5+
◊define-meta[page-description]{Command-Line Options}
6+
7+
◊section{Standard Command-Line Options}
8+
9+
Over time, there has evolved a loose standard for the meanings of
10+
command-line option flags. The GNU utilities conform more closely to
11+
this "standard" than older UNIX utilities.
12+
13+
Traditionally, UNIX command-line options consist of a dash, followed
14+
by one or more lowercase letters. The GNU utilities added a
15+
double-dash, followed by a complete word or compound word.
16+
17+
The two most widely-accepted options are:
18+
19+
◊definition-block[#:type "code"]{
20+
21+
◊definition-entry[#:name "-h, --help"]{
22+
Help
23+
24+
Give usage message and exit.
25+
26+
}
27+
28+
◊definition-entry[#:name "-v, --version"]{
29+
Version
30+
31+
Show program version and exit.
32+
33+
}
34+
35+
}
36+
37+
Other common options are:
38+
39+
◊definition-block[#:type "code"]{
40+
41+
◊definition-entry[#:name "-a, --all"]{
42+
All
43+
44+
Show all information or operate on all arguments.
45+
46+
}
47+
48+
◊definition-entry[#:name "-l, --list"]{
49+
List
50+
51+
List files or arguments without taking other action.
52+
53+
}
54+
55+
◊definition-entry[#:name "-o"]{
56+
Output filename
57+
58+
}
59+
60+
◊definition-entry[#:name "-q, --quiet"]{
61+
Quiet
62+
63+
Suppress stdout.
64+
65+
}
66+
67+
◊definition-entry[#:name "-r, -R, --recursive"]{
68+
Recursive
69+
70+
Operate recursively (down directory tree).
71+
72+
}
73+
74+
◊definition-entry[#:name "-v, --verbose"]{
75+
Verbose
76+
77+
Output additional information to stdout or stderr.
78+
79+
}
80+
81+
◊definition-entry[#:name "-z, --compress"]{
82+
Compress
83+
84+
Apply compression (usually ◊command{gzip}).
85+
86+
}
87+
88+
}
89+
90+
However:
91+
92+
◊definition-block[#:type "code"]{
93+
94+
◊definition-entry[#:name "In tar: -f, --file"]{
95+
File
96+
97+
Filename follows.
98+
99+
}
100+
101+
◊definition-entry[#:name "In cp, mv, rm:: -f, --force"]{
102+
Force
103+
104+
Force overwrite of target file(s).
105+
106+
}
107+
108+
}
109+
110+
Caution: Many UNIX and Linux utilities deviate from this "standard,"
111+
so it is dangerous to assume that a given option will behave in a
112+
standard way. Always check the man page for the command in question
113+
when in doubt.
114+
115+
A complete table of recommended options for the GNU utilities is
116+
available at the GNU standards page.
117+
118+
See: ◊url[#:link "https://www.gnu.org/prep/standards/"]{}
119+
120+
◊section{Bash Command-Line Options}
121+
122+
Bash itself has a number of command-line options. Here are some of the
123+
more useful ones.
124+
125+
◊definition-block[#:type "code"]{
126+
127+
◊definition-entry[#:name "-c"]{
128+
Read commands from the following string and assign any arguments to
129+
the positional parameters.
130+
131+
◊example{
132+
bash$ bash -c 'set a b c d; IFS="+-;"; echo "$*"'
133+
a+b+c+d
134+
}
135+
136+
}
137+
138+
◊definition-entry[#:name "-r, --restricted"]{
139+
Runs the shell, or a script, in restricted mode.
140+
141+
}
142+
143+
◊definition-entry[#:name "--posix"]{
144+
Forces Bash to conform to POSIX mode.
145+
146+
}
147+
148+
◊definition-entry[#:name "--"]{
149+
End of options.
150+
151+
Anything further on the command line is an argument,
152+
not an option.
153+
154+
}
155+
156+
}

0 commit comments

Comments
 (0)