Unix - 我该如何解决:找不到命令
Unix - How can I resolve :command not found
我有 2 个脚本 test1.sh & test2.sh,下面是定义。同样
猫test1.sh
DUP_CHK=`beeline --showHeader=false --outputformat=tsv2 -e "select count(*) from table1"`
echo "$DUP_CHK"
export DUP_CHK
猫test2.sh
#!/bin/bash
source ./test1.sh
cnt_chk="$DUP_CHK"
cnt_chk_2=`beeline --showHeader=false --outputformat=tsv2 -e "select count(*) from table1"`
echo "$DUP_CHK"
echo "$cnt_chk"
echo "$cnt_chk_2"
if "$cnt_chk -eq $cnt_chk_2"
then
echo "You are right"
exit 0
else
echo "Something is not right, check"
exit 0
fi
我传递的两个值相同,但是错误抛出为
test2.sh: line 18: 100 -eq 100: command not found
我在这里错过了什么。想法??谢谢
你需要
if((cnt_chk == cnt_chk2))
我有 2 个脚本 test1.sh & test2.sh,下面是定义。同样
猫test1.sh
DUP_CHK=`beeline --showHeader=false --outputformat=tsv2 -e "select count(*) from table1"`
echo "$DUP_CHK"
export DUP_CHK
猫test2.sh
#!/bin/bash
source ./test1.sh
cnt_chk="$DUP_CHK"
cnt_chk_2=`beeline --showHeader=false --outputformat=tsv2 -e "select count(*) from table1"`
echo "$DUP_CHK"
echo "$cnt_chk"
echo "$cnt_chk_2"
if "$cnt_chk -eq $cnt_chk_2"
then
echo "You are right"
exit 0
else
echo "Something is not right, check"
exit 0
fi
我传递的两个值相同,但是错误抛出为
test2.sh: line 18: 100 -eq 100: command not found
我在这里错过了什么。想法??谢谢
你需要
if((cnt_chk == cnt_chk2))