mirror of
https://github.com/fish-shell/fish-shell
synced 2024-12-26 12:53:13 +00:00
e7a964fdfa
As a simple replacement for `wc -l`. This counts both lines on stdin _and_ arguments. So if "file" has three lines, then `count a b c < file` will print 6. And since it counts newlines, like wc, `echo -n foo | count` prints 0.
29 lines
261 B
Text
29 lines
261 B
Text
|
|
####################
|
|
# no args
|
|
0
|
|
|
|
####################
|
|
# one args
|
|
1
|
|
|
|
####################
|
|
# two args
|
|
2
|
|
|
|
####################
|
|
# args that look like flags or are otherwise special
|
|
1
|
|
1
|
|
1
|
|
2
|
|
3
|
|
|
|
####################
|
|
# big counts
|
|
|
|
####################
|
|
# stdin
|
|
10
|
|
0
|
|
1
|