永发信息网

用shell脚本实现去sybase数据库执行查询语句,结果报以下错误,求各位大大看看怎么回事?

答案:2  悬赏:40  手机版
解决时间 2021-12-17 10:48
  • 提问者网友:空气里的回忆
  • 2021-12-17 02:47
用shell脚本实现去sybase数据库执行查询语句,结果报以下错误,求各位大大看看怎么回事?查询语句在sybase数据库执行没有错误,不知道为什么这里就执行不了。
./corpcs.sh: line 6: syntax error near unexpected token `from'
./corpcs.sh: line 6: `select customer,customer_name,short_name,local_lang_type,local_lang_cust_name,sovereign_off,address1,address2,address3,address4,city,state,postal_code,country,nearest_airport,phone,fax,email_address,www_server_addr,corp_code,customer_type,business_category,GST_reg_no,is_busi_partner,iata_code,active_flag,loc_row_crt_date,create_office_code from cust_service..n_cust where customer="$1"'

#!/bin/bash

checkcustomer(){
isql -Uxxx -Pxxx -Sxxxx
select customer,customer_name,short_name,local_lang_type,local_lang_cust_name,sovereign_off,address1,address2,address3,address4,city,state,postal_code,country,nearest_airport,phone,fax,email_address,www_server_addr,corp_code,customer_type,business_category,GST_reg_no,is_busi_partner,iata_code,active_flag,loc_row_crt_date,create_office_code from cust_service..n_cust where customer="$1"
go
}

for i in "$@"; do
echo "customer:$i"
checkcustomer $i
echo
done

已经知道为什么了,忘了加<
最佳答案
  • 五星知识达人网友:荒芜国度
  • 2021-12-17 03:12
改为:
checkcustomer(){
isql -Uxxx -Pxxx -Sxxxx < select customer,customer_name,short_name,local_lang_type,local_lang_cust_name,sovereign_off,address1,address2,address3,address4,city,state,postal_code,country,nearest_airport,phone,fax,email_address,www_server_addr,corp_code,customer_type,business_category,GST_reg_no,is_busi_partner,iata_code,active_flag,loc_row_crt_date,create_office_code from cust_service..n_cust where customer="$1"
go
EOF
}
全部回答
  • 1楼网友:尘事揪人心
  • 2021-12-17 03:32
可以私聊我~
我要举报
如以上回答内容为低俗、色情、不良、暴力、侵权、涉及违法等信息,可以点下面链接进行举报!
点此我要举报以上问答信息
大家都在看
推荐资讯