我有 2 個腳本 test1.sh 和 test2.sh,下面是 defn。對于相同的
貓 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
我在這里想念什么。想法??謝謝。
uj5u.com熱心網友回復:
你需要
if((cnt_chk == cnt_chk2))
轉載請註明出處,本文鏈接:https://www.uj5u.com/yidong/461193.html
標籤:Unix
上一篇:AWK適用于除前幾行之外的所有行
