summaryrefslogtreecommitdiffstats
path: root/docs/content/manual/manual.yml
diff options
context:
space:
mode:
authorEmanuele Torre <torreemanuele6@gmail.com>2024-01-30 17:38:40 +0100
committerNico Williams <nico@cryptonector.com>2024-01-30 12:23:33 -0600
commit13e02ba348b51b60350d142ab16f2ac6f4e5967a (patch)
tree146389443038441fae72cdabffd97b922311ebda /docs/content/manual/manual.yml
parentbd3c828f9844d0f885881041779d6bbdcc1451f6 (diff)
docs: rename example jq utility to total
Apparently sum(1) is a BSD and GNU coreutil used to compute the "16-bit BSD checksum" of a file.
Diffstat (limited to 'docs/content/manual/manual.yml')
-rw-r--r--docs/content/manual/manual.yml12
1 files changed, 6 insertions, 6 deletions
diff --git a/docs/content/manual/manual.yml b/docs/content/manual/manual.yml
index ff000e97..ef1d67f8 100644
--- a/docs/content/manual/manual.yml
+++ b/docs/content/manual/manual.yml
@@ -3571,8 +3571,8 @@ sections:
when writing the "shebang" for a jq script:
#!/bin/sh --
- # sum - Output the sum of the given arguments (or stdin)
- # usage: sum [numbers...]
+ # total - Output the sum of the given arguments (or stdin)
+ # usage: total [numbers...]
# \
exec jq --args -MRnf "$0" -- "$@"
@@ -3585,16 +3585,16 @@ sections:
. as $dot |
try tonumber catch false |
if not or isnan then
- @json "sum: Invalid number \($dot).\n" | halt_error(1)
+ @json "total: Invalid number \($dot).\n" | halt_error(1)
end
) as $n (0; . + $n)
The `exec` line is considered a comment by jq, so it is ignored.
But it is not ignored by `sh`, since in `sh` a backslash at the
end of the line does not continue the comment.
- With this trick, when the script is invoked as `sum 1 2`,
- `/bin/sh -- /path/to/sum 1 2` will be run, and `sh` will then
- run `exec jq --args -MRnf /path/to/sum -- 1 2` replacing itself
+ With this trick, when the script is invoked as `total 1 2`,
+ `/bin/sh -- /path/to/total 1 2` will be run, and `sh` will then
+ run `exec jq --args -MRnf /path/to/total -- 1 2` replacing itself
with a `jq` interpreter invoked with the specified options (`-M`,
`-R`, `-n`, `--args`), that evaluates the current file (`$0`),
with the arguments (`$@`) that were passed to `sh`.