How can select data from mysql using bash script and pass it to php?
Solution 1:
I fund the right syntax is:
#!/bin/bash
set -f # disable globbing
IFS=$'\n' # set field separator to NL (only)
arr=($(sudo mysql -u root -h localhost -e "USE mydb;SELECT * FROM users"))
for i in "${arr[@]}"
do
echo "$i"
done