Hi I am having a small shell script . however when i run the script it gives the error
sample.sh: line 5: return: null: numeric argument required
The following is my script
#!/bin/bash
function getHeader() {
return $(jq '."$1"' <<< $2)
}
RESPONSE='{"content-length":"2","address":"10.244.3.1:37930","path":"/hello-world"}'
echo $RESPONSE | jq '.'
x_header=$(getHeader "content-length" $RESPONSE )
I am also using jq library to handle the json data. In the above example i want the content-length value in the x_header variable
appreciate if you can help