'jq how to call function by value in variable
here i defined 2 functions and call the second directly:
$ jq -n 'def f1: "here f1" ; def f2: "here f2"; f2'
"here f2"
can i define a variable and call the function name contained in the value of that variable? for example:
$ jq --arg fp f1 -n 'def f1: "here f1" ; def f2: "here f2"; "fp is \($fp)"'
"fp is f1"
I want to call the function that is defined by the fp variable. so the result would be "fp is here f1"
Solution 1:[1]
can i define a variable and call the function name contained in the value of that variable?
No. You’d have to write a dispatcher.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 |
