免费注册 查看新帖 |

Chinaunix

  平台 论坛 博客 文库
最近访问板块 发新帖
查看: 1240 | 回复: 3
打印 上一主题 下一主题

sql的执行提示错误?!(DB=mysql) [复制链接]

论坛徽章:
0
跳转到指定楼层
1 [收藏(0)] [报告]
发表于 2004-08-07 13:08 |只看该作者 |倒序浏览
请教第一问:为什么执行的时候有以下提示?但是SQL执行是成功的。


[root@RIS02 itps]# ./test.sh
: No such file or directory
: command not found
Hello, Drewlee
Now we will log in MySQL......
: command not found

已经生成文件output_20040807.txt?
怎么把文件后的'?'去掉?实际字串是'\r'。

脚本文件test.sh:
!/bin/sh

echo 'Hello, Drewlee'
echo 'Now we will log in MySQL......'

mysql gecris < /home/itps/testsql.sql > /home/itps/output_`date "+%Y%m%d"`.txt

脚本文件testsql.sql
use gecris;
select p.PatientNameEnglish, p.PatientIntraID, e.ExamAccessionID, e.ExamType,e.E
xamSatus, e.PostExamReporterName, e.PostExamReportDate from PatientInfo p, ExamI
nfo e where e.ExamSatus = '已检查' and e.StudyInstanceUID != '' and e.PostExamRe
porterName != '' and e.PostExamReportDate != '' and p.PatientIntraID = e.Patient
IntraID;

update ExamInfo e set e.ExamSatus='已报告' where e.ExamSatus = '已检查' and e.St
udyInstanceUID != '' and e.PostExamReporterName != '' and e.PostExamReportDate !
= '';


请教第二问:怎么作串变量的追加运算?
如:
B='my'
C='god'
A=B+C 希望A='my god'

论坛徽章:
0
2 [报告]
发表于 2004-08-07 13:57 |只看该作者

sql的执行提示错误?!(DB=mysql)

1,脚本首行要用
#!/bin/sh
2,A="$B $C"

论坛徽章:
0
3 [报告]
发表于 2004-08-31 10:04 |只看该作者

sql的执行提示错误?!(DB=mysql)

很抱歉,我没有说清楚,我用的Linux 7.3,如果使用#!bin/sh,运行时系统会提示错误。
[root@RIS01 itps]# ./test.sh
: bad interpreter: No such file or directory

A="$B $C"
这方法也不灵!

得到的结果是:
B=hello
C=Drewlee
A="$B $C"


echo $A结果是 Drelee
[/quote]

论坛徽章:
0
4 [报告]
发表于 2004-08-31 10:14 |只看该作者

sql的执行提示错误?!(DB=mysql)

抱歉,我使用的是LINUX 7.3
使用#!/bin/sh,运行出错。
[root@RIS01 itps]# ./test.sh
: bad interpreter: No such file or directory

其次,A="$B $C"也不灵。
只能得到A串=1空格+C串的结果。

Dear bjgirl,希望得到你的QQ号,当面求教。谢谢。
E-mail:drewlee@tom.com
您需要登录后才可以回帖 登录 | 注册

本版积分规则 发表回复

  

北京盛拓优讯信息技术有限公司. 版权所有 京ICP备16024965号-6 北京市公安局海淀分局网监中心备案编号:11010802020122 niuxiaotong@pcpop.com 17352615567
未成年举报专区
中国互联网协会会员  联系我们:huangweiwei@itpub.net
感谢所有关心和支持过ChinaUnix的朋友们 转载本站内容请注明原作者名及出处

清除 Cookies - ChinaUnix - Archiver - WAP - TOP