Hello everybody, I need to do a loop on my mysql output (packetid) and put it everytime on the second SELECT command, to have a result for each packetid and put it everytime on text file. can you help me please? Thank you so much
#!/bin/bash array=$(mysql -u root -pMyPassword -s -N <<QUERY_INPUT use myDatabase; SELECT packetid FROM wifi; QUERY_INPUT ); echo "${array[@]}"; for i in "${array[@]}" do variable=$(mysql -u root -pMyPassword -s -N <<QUERY_INPUT use myDatabase; SELECT CONCAT("{""wlan"": [",GROUP_CONCAT(JSON_OBJECT(" mac",bssid,"powrx",rssi)), "]}") FROM wifi WHERE packetid=$i; QUERY_INPUT ); echo $variable>text2.txt; done