I have 2 scripts test1.sh & test2.sh, below is the defn. for the same
cat test1.sh
DUP_CHK=`beeline --showHeader=false --outputformat=tsv2 -e "select count(*) from table1"`
echo "$DUP_CHK"
export DUP_CHK
cat 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
I am passing both value as same but, the error throws as
test2.sh: line 18: 100 -eq 100: command not found
What am I missing here. Thoughts?? Thanks.
CodePudding user response:
You need
if((cnt_chk == cnt_chk2))