在shell脚本中,我从数据库中检索数据并尝试打印它,但它不打印,因为我正在尝试执行此操作。从数据库中检索数据并在shell脚本中打印值
我的代码是:
mysql -uroot -proot -Dproject_ivr_db -rN --execute "SELECT Regular FROM
Fee_MSc WHERE Fee_Type='Total:'" | while read value
x=1
do
echo "V,FeeRegular_$y=$value"
let "y+=1"
done
echo "V,fee_msc_regular="for students on regular basis admission fee
including other charges is $FeeRegular_1 and semester fee is $FeeRegular_2""
输出是:
V,FeeRegular_1=12590
V,FeeRegular_2=12850
V,fee_msc_regular=for students on regular basis admission fee including other
charges is and semester fee is
它不会在字符串输出打印$FeeRegular_1
和$FeeRegular_2
值。
如何在输出字符串中获取这些变量的值?
哪个外壳?为什么以root用户身份登录数据库来运行查询?那是什么样的密码? – Johnsyweb 2013-02-13 12:46:54
root是我为mysql数据库设置的密码以及根名称,并且没有任何错误,因为对于数据库而言,问题是使用echo语句 – shehzy 2013-02-13 13:33:05
并且我使用了星号拨号计划,而我必须最终使用这些值和壳写在test3.sh文件 – shehzy 2013-02-13 13:38:24