用shell脚本实现去sybase数据库执行查询语句,结果报以下错误,求各位大大看看怎么回事?
用shell脚本实现去sybase数据库执行查询语句,结果报以下错误,求各位大大看看怎么回事?查询语句在sybase数据库执行没有错误,不知道为什么这里就执行不了。./c...
用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
已经知道为什么了,忘了加<<EOF ....EOF 展开
./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
已经知道为什么了,忘了加<<EOF ....EOF 展开
1个回答
展开全部
改为:
checkcustomer(){
isql -Uxxx -Pxxx -Sxxxx <<EOF
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
}
checkcustomer(){
isql -Uxxx -Pxxx -Sxxxx <<EOF
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
}
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询
广告 您可能关注的内容 |