@@ -176,6 +176,7 @@ to find where it is).
176
176
1 . [ Security and correctness] ( #security-and-correctness )
177
177
1 . [ ` jb-cat ` , ` jb-echo ` , ` jb-stream ` utility programs] ( #jb-cat-jb-echo-jb-stream-utility-programs )
178
178
1 . [ Streaming output] ( #streaming-output )
179
+ 1 . [ Configuring environment variables] ( #configuring-environment-variables )
179
180
180
181
These examples mostly use ` jb ` , which is the ` json.bash ` library run as a
181
182
stand-alone program. From within a bash script you get better performance by
@@ -1010,6 +1011,30 @@ inputs, even when backtracking and matched-region output are disabled.
1010
1011
The full syntax of ` jb ` arguments is documented in a (pseudo) grammar in
1011
1012
[ hack/syntax_patterns.bash] ( hack/syntax_patterns.bash ) .
1012
1013
1014
+ ### Configuring environment variables
1015
+
1016
+ ` json.bash ` can be configured by setting certain environment variables:
1017
+
1018
+ #### ` JSON_BASH_GREP `
1019
+
1020
+ The command(s) to run to start the JSON validator grep co-process.
1021
+
1022
+ Default: ` ggrep:grep `
1023
+
1024
+ ` json.bash ` uses a
1025
+ [ regular expression to validate JSON data] ( ./hack/syntax_patterns.bash ) . It uses
1026
+ a GNU grep co-process to validate lines of JSON data using this regex
1027
+ (specifically GNU grep, because it's a [ PCRE] expression).
1028
+
1029
+ This environment variable contains a list of command names or absolute paths to
1030
+ execute. Multiple commands are separated with ` : ` . The first command that exists
1031
+ is used, so the list can contain missing commands, so long as one exists.
1032
+
1033
+ The default of ` ggrep:grep ` means ` ggrep ` will be used if it's available,
1034
+ otherwise ` grep ` .
1035
+
1036
+ [ PCRE ] : https://en.wikipedia.org/wiki/Perl_Compatible_Regular_Expressions
1037
+
1013
1038
## Background & performance notes
1014
1039
1015
1040
Quite reasonably, you may be wondering why anyone would use Bash to implement a
0 commit comments