如果 sql 不正确,我试图让下面的命令执行某些操作
for filename in test.txt
do
mysql -N -e "SELECT ROLE FROM SENTRY WHERE ROLE = '$filename';"
exitcode=$?
if [ $exitcode -ne 0 ]; then
echo did not succeed
else
echo succeeded
fi
done
当我运行这个脚本时它返回:
success
success
success
这不是真的
test.txt 包含
admin
test1
test2
从哨兵返回中选择角色
admin
user