Our dev who is not familiar with openwrt is trying to code something but he's not getting anywhere.
He has this kind of sting for example;
[{"mn":"001","sn":"001","fr":"00.69","hr":"01.00"}]
[{"1":"26.75","2":"42.16","3":"9","4":"827.301","5":"78.53","6":"2","7":"415","8":"73.10","9":"21.71","10":"0","11":"0.0","12":"0.0","13":"0.000"}]
which is mainly two JSON separated by a newline that I get and place into a variable.
I need to split these int two bash variables.
I tried the following but with no result
## Execute command
what="/etc/pgm_that_sends_back_the string"
which_command=$($what)
echo "FULL: $which_command"
## Split string into an array
IFS="\n"
read -ra tmp <<< "$which_command"
IFS=' '
## Assign array elements to single variables
json_0=${tmp[0]}
json_1=${tmp[1]}
The result is always weird since it is interpreting "\n" as the letter "n"
Any idea of how to do it using openwrt bash?