縱觀互聯網上的方法來讀取MySQL數據庫在bash多行我做如下:錯誤而從MySQL在bash讀取多個行
i=0
while read relation_id
do
echo "Record $((i++)) $relation_id"
done < <(mysql -u$db_user -p$db_password -h$db_host -D$db_name -se "SELECT id where connection_id=$id")
但不幸的是我收到以下錯誤:
temp.sh: line 11: syntax error near unexpected token `<'
temp.sh: line 11: `done < <(mysql -u$db_user -p$db_password -h$db_host -D$db_name -se "SELECT id where connection_id=$id")'
請幫我知道我做錯了什麼。
是的,我現在用的是相同的查詢做其他事情。 – Prometheus
所有上面的命令正確定義的稱爲變量? – Inian