gpt4 book ai didi

mysql - 在 bash 中从 mysql 读取多行时出错

转载 作者:行者123 更新时间:2023-11-30 22:12:35 25 4
gpt4 key购买 nike

查看 Internet 上在 bash 中从 mysql db 读取多行的方法,我正在执行以下操作:

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")'

请帮助我知道我做错了什么。

最佳答案

去掉空格done <<(mysql这里应该是<<不是<

关于mysql - 在 bash 中从 mysql 读取多行时出错,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/39585974/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com