Skip to content

Instantly share code, notes, and snippets.

@laoshuterry
Created October 31, 2015 09:56
Show Gist options
  • Save laoshuterry/61bf4f649f80759e0ae6 to your computer and use it in GitHub Desktop.
Save laoshuterry/61bf4f649f80759e0ae6 to your computer and use it in GitHub Desktop.
#!/bin/bash
. $HOME/.profile
echo "start `basename $0`"
#echo $*
declare -a number=0
declare -i i=0
#read number
cat number.txt |while read num
do
#echo $num
number[$i]=$num
echo ${number[$i]}
i=i+1
done
echo ${number[0]}
ALTI="isql -s 10.161.7.56 -u occ_bf -p occ_bf -port 20300 -NLS_USE US7ASCII"
data=`$ALTI <<!
select serial_number,sync_state,rsp_code from USER_STATE_SYNC where serial_number=${name[0]};
!`
#if not find data ,then succeed
data1=`echo $data |grep "No rows selected"`
if [ -n "$data1" ];then
echo "USER_STATE_SYNC succeed"
else
echo "aaaaaaaaaaaaa"
fi
#if find data ,then succeed
echo data=$data
data=`echo $data |grep 18001136289`
echo $data >/tmp/testdata
awk -F "18001136289" '{print $2}' /tmp/testdata |awk -F "1 row" '{print $1}'|while read sync_state rsp_code
do
echo sync_state=$sync_state,rsp_code=$rsp_code
if [ "$rsp_code" != "0000" ];then
echo "USER_STATE_SYNC succeed"
fi
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment