Warning: file_get_contents(/data/phpspider/zhask/data//catemap/5/bash/17.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Linux 负运算是错误的_Linux_Bash - Fatal编程技术网

Linux 负运算是错误的

Linux 负运算是错误的,linux,bash,Linux,Bash,我的脚本如下: 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;

我的脚本如下:

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
     ------------------------------------------------------------------------------------";
用于{“CON”、“PA”、“PRO”、“RE”、“S”、“UN”、“VO”中的i;
做
count=$(sqlplus-S$user/$pass
我发现了我的错误,

count=$(sqlplus-S$user/$passoops。看起来像是您的问候语和“我的脚本在下面”你的代码被吸收了。你可以编辑它。请考虑接受你的问题的好答案。因为这个问题的代码来自于代码,我怀疑你在这方面有一些不足之处。结果是什么而不是0?你确定<代码> $计数$< /代码>与<代码> $CuNUT < /代码>?1。请小心使用<代码> $$。
s在这里文档:
s.type='$i'
.2.我想您需要这个:
$($thecount-$count))
(带间隔).3.在脚本中使用
bash-x
set-x
进行调试。@Andras Deak,很抱歉没有单击“接受”图标。现在我做了。是的,我确信它完全相同。我打印时没有进行减号操作。结果是一样的。@Harvey,我使用了你的,结果如下。计数------4438 DB文件低于f中的8876文件数更老,呵呵,这是多操作。它应该是0而不是8876。设置页面大小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" ?