Clarify -f argument parsing (#3199)
This commit is contained in:
1 parent
eb9bdca296
commit
32a304b912
3 files changed
+11
-10
No files matched your search
@@ -221,10 +221,11 @@ sections:
|
||||
RS. This mode also parses the output of jq without the `--seq`
|
||||
option.
|
||||
|
||||
* `-f filename` / `--from-file filename`:
|
||||
* `-f` / `--from-file`:
|
||||
|
||||
Read filter from the file rather than from a command line, like
|
||||
awk's -f option.
|
||||
Read the filter from a file rather than from a command line,
|
||||
like awk's -f option. This changes the filter argument to be
|
||||
interpreted as a filename, instead of the source of a program.
|
||||
|
||||
* `-L directory` / `--library-path directory`:
|
||||
|
||||
@@ -3633,7 +3634,7 @@ sections:
|
||||
# total - Output the sum of the given arguments (or stdin)
|
||||
# usage: total [numbers...]
|
||||
# \
|
||||
exec jq --args -MRnf "$0" -- "$@"
|
||||
exec jq --args -MRnf -- "$0" "$@"
|
||||
|
||||
$ARGS.positional |
|
||||
reduce (
|
||||
@@ -3653,7 +3654,7 @@ sections:
|
||||
end of the line does not continue the comment.
|
||||
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
|
||||
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`.
|
||||
|
||||
Reference in new issue
Block a user