mysql - 如何修复仅返回 0
问题描述
我有这个 bash 脚本,我想在 mysql 中搜索 list.txt 中的所有内容
如果找不到,我想将其写入 newout.txt 文件。
一切都在 list.txt 中相互写入
#!/bin/bash
file="/tmp/list.txt"
while IFS= read -r line
do
FIELDVALUE=$(mysql databse -u user-ppw -e "SELECT count(name) FROM db WHERE name LIKE '$line';")
count=$(echo $FIELDVALUE |awk '{print $2}')
if [ $count -gt 0 ]
then
echo "greater that 0 "
else
echo "$line" >> /tmp/newout.txt
fi
done <"$file"
我总是回到 0 虽然它肯定在那里
: 0 低于 0 0 低于 0
解决方案
推荐阅读
- laravel - 我们无法识别您的电子邮件地址
- bash - 替换文件中的环境变量
- java - 如何在 Java Azure 函数中使用事件中心触发器
- laravel - 无法返回登录页面
- python - oracle使用python更新sql
- visual-studio - Xamarin Android 项目签名与 V2 签名(Visual Studio 2019 专业版)
- react-native - Visual Stuiod Code Intellisense 不适用于 React Native 别名
- scons - Python SCons 行动?
- java - 这两种创建对象的方式有区别吗
- java - Neo4J 使用哪种哈希算法?