-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathwc
More file actions
34 lines (31 loc) · 587 Bytes
/
Copy pathwc
File metadata and controls
34 lines (31 loc) · 587 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
# [20240628] `wc` - Wrapper of `wc` (word count).
# See also: https://www.gnu.org/software/coreutils/manual/coreutils.html#wc-invocation
wc='/usr/bin/wc';
for x0;
do {
# >>>> (0)
[ "$x0" != '--help' ] || {
cat "$0";
echo;
exec "$wc" --help 2>&1;
};
[ "$x0" != '--' ] || break;
# <<<< (0)
};
done;
#
# If meaningful option specified: invoke as specified.
# Else: "-lwmc"
#
for x0;
do
[ "${x0%%[!-]*}" = '-' ] &&
[ "$x0" != '--' ] && exec "$wc" "$@";
done;
exec "$wc" -lwmc "$@";
#
# "-l": Line count.
# "-w": Word count.
# "-m": Character count.
# "-c": Byte count.
#