- 论坛徽章:
- 0
|
本帖最后由 傻卟拉几 于 2011-11-10 17:38 编辑
回复 1# 傻卟拉几
#!/bin/bash
echo -n 'Please Input your ent_id: '
read ent_id
echo -n 'Please Make Sure you Enter is Correct:[y/n]'
read input
if [ $input == y ];then
mysql --user=root --password=123456 --host=localhost <<EOF>a.txt
select CONCAT(ent_id,',',sd_oid,',',ad_oid,',',prod_id,',',status) from sdm.ent where ent_id=$ent_id;
EOF
sed '1d' a.txt > b.txt
rm -rf a.txt
b=`cat b.txt | wc -l`
if [ $b == 0 ];then
echo 'Please retype !!!'
else
sd_oid=`awk -F , '{print $2}' b.txt`
prod=`awk -F , '{print $4}' b.txt`
echo -n 'Please enter the name of your prod_id: '
read prod_id
if [ $prod == $prod_id ];then
mysql --user=root --password=123456 --host=localhost <<EOF>a.txt
#
select CONCAT(ent_id,',',status) from sdm.tenant where ent_id=$ent_id;
#
EOF
#
# sed '1d' a.txt > c.txt
# rm -rf a.txt
# c=`cat c.txt | wc -l`
echo 'successsfully!'
fi
fi
fi
为什么将第二次引用mysql就会有a.sh: line 38: syntax error: unexpected end of file 错误信息
高手快来 |
|