当前位置: 技术问答>linux和unix
.sh 的问题
来源: 互联网 发布时间:2017-01-08
本文导语: 01_before_file_upload文件下有四个文件夹,两个文件,分别是: csv(文件夹) ctl(文件夹) log(文件夹) sql(文件夹) 101_load_and_validation.sh setenv.sh ------------------------------------------------------------ 其中setenv.sh中的内容如下: DB_...
01_before_file_upload文件下有四个文件夹,两个文件,分别是:
csv(文件夹)
ctl(文件夹)
log(文件夹)
sql(文件夹)
101_load_and_validation.sh
setenv.sh
------------------------------------------------------------
其中setenv.sh中的内容如下:
DB_NAME=cmsanzdb
DB_USER=lanita
DB_PASSWORD=lanita
---------------------------------------------------------------
其中101_load_and_validation.sh中的内容如下:
. ./setenv.sh
rm log/*.log
rm log/*.bad
rm log/*.dsc
sqlplus $DB_USER/$DB_PASSWORD@$DB_NAME @sql/101_generate_disable_constraints_sql.sql
sqlplus $DB_USER/$DB_PASSWORD@$DB_NAME @sql/101_disable_constraints.sql
sqlplus $DB_USER/$DB_PASSWORD@$DB_NAME @sql/101_clear_data_setup_from_master.sql
sqlplus $DB_USER/$DB_PASSWORD@$DB_NAME @sql/101_create_ds_tables.sql
sqlldr userid=$DB_USER/$DB_PASSWORD@$DB_NAME data=csv/HOLIDAY.csv control=ctl/HOLIDAY.ctl bad=log/HOLIDAY.bad discard=log/HOLIDAY.dsc log=log/HOLIDAY.log > log/101_load_and_validation.log 2>&1
--------------------------------------------------------------
我在cygwin中执行
./101_load_and_validation.sh
出现下面的错误:
Administrator@CRMSERVER /cygdrive/d/share/lanita/01_before_file_upload
$ ./101_load_and_validation.sh
: No such file or directoryh: line 1: ./setenv.sh
./101_load_and_validation.sh: line 2: $'r': command not found
rm: cannot remove `log/*.logr': No such file or directory
rm: cannot remove `log/*.badr': No such file or directory
rm: cannot remove `log/*.dscr': No such file or directory
./101_load_and_validation.sh: line 6: $'r': command not found
请问是什么原因呢?应当怎么解决呢?
csv(文件夹)
ctl(文件夹)
log(文件夹)
sql(文件夹)
101_load_and_validation.sh
setenv.sh
------------------------------------------------------------
其中setenv.sh中的内容如下:
DB_NAME=cmsanzdb
DB_USER=lanita
DB_PASSWORD=lanita
---------------------------------------------------------------
其中101_load_and_validation.sh中的内容如下:
. ./setenv.sh
rm log/*.log
rm log/*.bad
rm log/*.dsc
sqlplus $DB_USER/$DB_PASSWORD@$DB_NAME @sql/101_generate_disable_constraints_sql.sql
sqlplus $DB_USER/$DB_PASSWORD@$DB_NAME @sql/101_disable_constraints.sql
sqlplus $DB_USER/$DB_PASSWORD@$DB_NAME @sql/101_clear_data_setup_from_master.sql
sqlplus $DB_USER/$DB_PASSWORD@$DB_NAME @sql/101_create_ds_tables.sql
sqlldr userid=$DB_USER/$DB_PASSWORD@$DB_NAME data=csv/HOLIDAY.csv control=ctl/HOLIDAY.ctl bad=log/HOLIDAY.bad discard=log/HOLIDAY.dsc log=log/HOLIDAY.log > log/101_load_and_validation.log 2>&1
--------------------------------------------------------------
我在cygwin中执行
./101_load_and_validation.sh
出现下面的错误:
Administrator@CRMSERVER /cygdrive/d/share/lanita/01_before_file_upload
$ ./101_load_and_validation.sh
: No such file or directoryh: line 1: ./setenv.sh
./101_load_and_validation.sh: line 2: $'r': command not found
rm: cannot remove `log/*.logr': No such file or directory
rm: cannot remove `log/*.badr': No such file or directory
rm: cannot remove `log/*.dscr': No such file or directory
./101_load_and_validation.sh: line 6: $'r': command not found
请问是什么原因呢?应当怎么解决呢?
|
这显然是DOS/Windows换行符引起的问题,r一般不会打印出来的。
|
. ./setenv.sh 可以先cd ..再./setenv.sh
r出错是回车键有问题
rm你换成绝对路径
r出错是回车键有问题
rm你换成绝对路径
|
注意路径。。
|
在shell中,最好给出绝对路径,不要使用相对路径。