gpt4 book ai didi

linux - 减号操作错误

转载 作者:太空宇宙 更新时间:2023-11-04 12:59:21 24 4
gpt4 key购买 nike

我的脚本如下:

for i in {"CON","PA","PRO","RE","S","UN","VO"};
do
count=$(sqlplus -S $user/$pass<<EOF
select count(distinct s.filename) as count
from cd.tbl_1 s
where s.dt like to_char(sysdate-1,'YYYYMMDD')||'%' and s.type='$i';
exit;
EOF)
yday=$(date --date="yesterday" +"%b %_d")
thecount=$(ls . -ltr | grep "$yday" | wc -l)
echo $i" ON DB $count DB files is lower than the number $((thecount-count)) files in folder
------------------------------------------------------------------------------------";

但有趣的是 $thecount$count 的值完全相同,所以当我像上面那样使用减号运算时,它没有 0 值和不同的值。所以它不减正确。这里有什么问题?

最佳答案

I found my mistake, 

count=$(sqlplus -S $user/$pass<<EOF
select count(distinct s.filename) as count
from cd.tbl_1 s
where s.dt like to_char(sysdate-1,'YYYYMMDD')||'%' and s.type='$i';
exit;
EOF)

this part is printing non-numeric values which is like below

COUNT ---------- 5663

that's why cannot any operation on those numbers.

So how do i select only numbers "5663" ?

关于linux - 减号操作错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/34668074/

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