Linux - /bin/sh^M: bad interpreter: No such file or directory

版权声明:本文为博主原创文章,遵循 CC 4.0 by-sa 版权协议,转载请附上原文出处链接和本声明。
本文链接:https://blog.csdn.net/lewky_liu/article/details/99495945

问题

在Windows环境下用Notepad++写了个shell脚本,上传到Linux平台后运行报错如下:

/bin/sh^M: bad interpreter: No such file or directory

经过查阅资料才知道,这是由于文件格式的问题:使用vi/vim进入该shell文件,按下:进入末行模式,输入set ff查询文件格式,结果如下:

fileformat=dos

这个问题是由于不同的操作系统使用了不同的符号来换行导致的,可以简单参考下下面的表格:

系统 换行符
DOS CR/LF
UNIX LF
MAC CR

如果通过Windows下的Git将文件提交到Linux上的服务器,也会收到换行符将被替换的消息通知。

解决方案

通过vi/vim进入想要修改的文件,按下:进入末行模式,输入set fileformat=unix,接着按下ZZ或者按下shift + z + z或者输入:x或者:wq保存修改即可。

参考链接

展开阅读全文

HADOOP2.6+SQOOP1.99.4-Oracle导入提示:/bin/bash: /bin/java: No such file or directory

01-11

本人Hadoop新手,本机Mac环境,版本如下:rnHadoop:2.6.0rnSqoop:1.99.4rnrn使用Sqoop从Oracel导入到Hdfs时错误:/bin/bash: /bin/java: No such file or directory;(从web端的Log查看);rn1、web端log如下:rnhttp://6thman-Pro.local:8088/cluster/app/application_1420939266073_0002rnApplication application_1420894910576_0001 failed 2 times due to AM Container for appattempt_1420894910576_0001_000002 exited with exitCode: 127rnFor more detailed output, check application tracking page:http://wqdeMacBook-Pro.local:8088/proxy/application_1420894910576_0001/Then, click on links to logs of each attempt.rnDiagnostics: Exception from container-launch.rnContainer id: container_1420894910576_0001_02_000001rnExit code: 127rnStack trace: ExitCodeException exitCode=127:rnat org.apache.hadoop.util.Shell.runCommand(Shell.java:538)rnat org.apache.hadoop.util.Shell.run(Shell.java:455)rnat org.apache.hadoop.util.Shell$ShellCommandExecutor.execute(Shell.java:715)rnat org.apache.hadoop.yarn.server.nodemanager.DefaultContainerExecutor.launchContainer(DefaultContainerExecutor.java:211)rnat org.apache.hadoop.yarn.server.nodemanager.containermanager.launcher.ContainerLaunch.call(ContainerLaunch.java:302)rnat org.apache.hadoop.yarn.server.nodemanager.containermanager.launcher.ContainerLaunch.call(ContainerLaunch.java:82)rnat java.util.concurrent.FutureTask.run(FutureTask.java:266)rnat java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)rnat java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)rnat java.lang.Thread.run(Thread.java:745)rnContainer exited with a non-zero exit code 127rnFailing this attempt. Failing the application.rnrnrn2、Job信息如下:rn>show job all:rnJob with id 8 and name newTest2 (Enabled: true, Created by wq at 15-1-10 下午8:01, Updated by wq at 15-1-10 下午8:57)rnUsing link id 4 and Connector id 1rn From database configurationrn Schema name: PBEMrn Table name: PRO_RTUrn Table SQL statement: rn Table column names: rn Partition column name: rn Null value allowed for the partition column: rn Boundary query: rn Throttling resourcesrn Extractors: 2rn Loaders: 2rn ToJob configurationrn Output format: TEXT_FILErn Compression format: NONErn Custom compression format: rn Output directory: /user/wq/sqoop/rnrn3、从sqoop.log看,远程数据库已经成功获取表及字段信息,但本地未成功;怀疑/user/wq/sqoop的路径不对,但本机使用:hdfs dfs -ls 可成功查看该路径;rnrnsqoop.log如下:rn2015-01-11 09:26:47,732 INFO jdbc.GenericJdbcFromInitializer [org.apache.sqoop.connector.jdbc.GenericJdbcFromInitializer.configureTableProperties(GenericJdbcFromInitializer.java:320)] Field names: ORGNO,ID,STATUS,NAME,GUID,SORTBY,PROPERTY,ISPHYSICALDEVICES,COMPANYID,SUBSTATIONID,CHARGEACCOUNT,CTRLHOSTID,ADDRESS,CHANNELMODE1,CHANNELID1,CHANNELMODE2,CHANNELID2,CHANNELMODE3,CHANNELID3,IPPORT1,IPPORT2,TEL1,TEL2,ASSETNUMBER,FACTORY,MODEL,SETUPDATETIME,SETUPPOSITION,SETUPOPERATOR,SCHEMEID,PASSWORD,AREACODEID,AUTOGETEVENT,HEARTOUTTIME,EVENTID1,EVENTID2,WAKEMODE,CONTROLFLAG,MASTERID,SIMCARDNUMBER,CONTACTMAN,CONTACTADDR,CONTACTPHONE,TRANSFORMERDID,OWNER,LINEID,CONSUMERID,RULEIDrn2015-01-11 09:26:47,918 DEBUG driver.JobManager [org.apache.sqoop.driver.JobManager.createJobRequest(JobManager.java:377)] Using entities: Frominitializer=org.apache.sqoop.connector.jdbc.GenericJdbcFromInitializer, destroyer=org.apache.sqoop.connector.jdbc.GenericJdbcFromDestroyer, partitioner=org.apache.sqoop.connector.jdbc.GenericJdbcPartitioner, extractor=org.apache.sqoop.connector.jdbc.GenericJdbcExtractor, To initializer=org.apache.sqoop.connector.hdfs.HdfsToInitializer, destroyer=org.apache.sqoop.connector.hdfs.HdfsToDestroyer, loader=class org.apache.sqoop.connector.hdfs.HdfsLoaderrn2015-01-11 09:26:47,918 DEBUG repository.JdbcRepositoryTransaction [org.apache.sqoop.repository.JdbcRepositoryTransaction.begin(JdbcRepositoryTransaction.java:73)] Tx count-begin: 1, rollback: falsern2015-01-11 09:26:47,920 DEBUG repository.JdbcRepositoryTransaction [org.apache.sqoop.repository.JdbcRepositoryTransaction.commit(JdbcRepositoryTransaction.java:84)] Tx count-commit: 1, rollback: falsern2015-01-11 09:26:47,920 DEBUG repository.JdbcRepositoryTransaction [org.apache.sqoop.repository.JdbcRepositoryTransaction.close(JdbcRepositoryTransaction.java:103)] Tx count-close: 0, rollback: falsern2015-01-11 09:26:47,920 INFO repository.JdbcRepositoryTransaction [org.apache.sqoop.repository.JdbcRepositoryTransaction.close(JdbcRepositoryTransaction.java:111)] Attempting transaction commitrn2015-01-11 09:26:49,785 DEBUG mr.SqoopInputFormat [org.apache.sqoop.job.mr.SqoopInputFormat.getSplits(SqoopInputFormat.java:76)] Partition: 10000004 <= ID AND ID < 10000012.5rn2015-01-11 09:26:49,786 DEBUG mr.SqoopInputFormat [org.apache.sqoop.job.mr.SqoopInputFormat.getSplits(SqoopInputFormat.java:76)] Partition: 10000012.5 <= ID AND ID <= 10000021.0rn2015-01-11 09:26:50,304 DEBUG mapreduce.MapreduceSubmissionEngine [org.apache.sqoop.submission.mapreduce.MapreduceSubmissionEngine.submit(MapreduceSubmissionEngine.java:253)] Executed new map-reduce job with id job_1420939266073_0002rn2015-01-11 09:26:50,305 DEBUG repository.JdbcRepositoryTransaction [org.apache.sqoop.repository.JdbcRepositoryTransaction.begin(JdbcRepositoryTransaction.java:73)] Tx count-begin: 1, rollback: falsern2015-01-11 09:26:50,307 DEBUG repository.JdbcRepositoryTransaction [org.apache.sqoop.repository.JdbcRepositoryTransaction.commit(JdbcRepositoryTransaction.java:84)] Tx count-commit: 1, rollback: falsern2015-01-11 09:26:50,307 DEBUG repository.JdbcRepositoryTransaction [org.apache.sqoop.repository.JdbcRepositoryTransaction.close(JdbcRepositoryTransaction.java:103)] Tx count-close: 0, rollback: falsern2015-01-11 09:26:50,307 INFO repository.JdbcRepositoryTransaction [org.apache.sqoop.repository.JdbcRepositoryTransaction.close(JdbcRepositoryTransaction.java:111)] Attempting transaction commitrn2015-01-11 09:26:55,513 DEBUG repository.JdbcRepositoryTransaction [org.apache.sqoop.repository.JdbcRepositoryTransaction.begin(JdbcRepositoryTransaction.java:73)] Tx count-begin: 1, rollback: falsern2015-01-11 09:26:55,513 DEBUG derby.DerbyRepositoryHandler [org.apache.sqoop.repository.derby.DerbyRepositoryHandler.findDriver(DerbyRepositoryHandler.java:1073)] Looking up Driver and config rn2015-01-11 09:26:55,515 DEBUG derby.DerbyRepositoryHandler [org.apache.sqoop.repository.derby.DerbyRepositoryHandler.findDriver(DerbyRepositoryHandler.java:1129)] Looked up Driver and configrn2015-01-11 09:26:55,515 DEBUG repository.JdbcRepositoryTransaction [org.apache.sqoop.repository.JdbcRepositoryTransaction.commit(JdbcRepositoryTransaction.java:84)] Tx count-commit: 1, rollback: falsern2015-01-11 09:26:55,515 DEBUG repository.JdbcRepositoryTransaction [org.apache.sqoop.repository.JdbcRepositoryTransaction.close(JdbcRepositoryTransaction.java:103)] Tx count-close: 0, rollback: falsern2015-01-11 09:26:55,515 INFO repository.JdbcRepositoryTransaction [org.apache.sqoop.repository.JdbcRepositoryTransaction.close(JdbcRepositoryTransaction.java:111)] Attempting transaction commitrn2015-01-11 09:26:55,516 INFO default [org.apache.sqoop.audit.FileAuditLogger.logAuditEvent(FileAuditLogger.java:86)] user=wq ip=127.0.0.1 op=status obj=job objId=8rn2015-01-11 09:26:55,516 DEBUG repository.JdbcRepositoryTransaction [org.apache.sqoop.repository.JdbcRepositoryTransaction.begin(JdbcRepositoryTransaction.java:73)] Tx count-begin: 1, rollback: falsern2015-01-11 09:26:55,517 DEBUG repository.JdbcRepositoryTransaction [org.apache.sqoop.repository.JdbcRepositoryTransaction.commit(JdbcRepositoryTransaction.java:84)] Tx count-commit: 1, rollback: falsern2015-01-11 09:26:55,517 DEBUG repository.JdbcRepositoryTransaction [org.apache.sqoop.repository.JdbcRepositoryTransaction.close(JdbcRepositoryTransaction.java:103)] Tx count-close: 0, rollback: falsern2015-01-11 09:26:55,517 INFO repository.JdbcRepositoryTransaction [org.apache.sqoop.repository.JdbcRepositoryTransaction.close(JdbcRepositoryTransaction.java:111)] Attempting transaction commitrn2015-01-11 09:26:55,598 DEBUG repository.JdbcRepositoryTransaction [org.apache.sqoop.repository.JdbcRepositoryTransaction.begin(JdbcRepositoryTransaction.java:73)] Tx count-begin: 1, rollback: falsern2015-01-11 09:26:55,599 DEBUG repository.JdbcRepositoryTransaction [org.apache.sqoop.repository.JdbcRepositoryTransaction.commit(JdbcRepositoryTransaction.java:84)] Tx count-commit: 1, rollback: falsern2015-01-11 09:26:55,599 DEBUG repository.JdbcRepositoryTransaction [org.apache.sqoop.repository.JdbcRepositoryTransaction.close(JdbcRepositoryTransaction.java:103)] Tx count-close: 0, rollback: falsern2015-01-11 09:26:55,600 INFO repository.JdbcRepositoryTransaction [org.apache.sqoop.repository.JdbcRepositoryTransaction.close(JdbcRepositoryTransaction.java:111)] Attempting transaction commitrn rnrnrn自己只能看出明显的:exitcode:127、还有就是No such file or directory;rn折腾修改了一天,还是没找到原因,还请高手指点,不知道哪里理解、设置的不对;rn新号(之前的不能用了),分不多,请高手仗义出手,感谢!rn 论坛

/bin/sh: ./madplay: not found

04-21

移植madplay遇到一个比较纠结的问题,请大家帮我看看 以下在星号线之间的是脚本rnrn[code=Assembly]rnjiaoben1:rn*********************************************************************************rn#!/bin/bashrnBIN=/opt/FriendlyARM/toolschain/4.4.3rnTAR=/root/mymad/libzrnrntar -xvzf /mnt/hgfs/code/zlib-1.1.4.tar.gz -C /root/mymadrntar -xvzf /mnt/hgfs/code/libmad-0.15.1b.tar.gz -C /root/mymadrntar -xvzf /mnt/hgfs/code/libid3tag-0.15.1b.tar.gz -C /root/mymadrntar -xvzf /mnt/hgfs/code/madplay-0.15.2b.tar.gz -C /root/mymadrnrncd /root/mymad/zlib-1.1.4rnrn./configure --prefix=$TAR rn*************************************************************************************rn手动 修改Makefile:rnrnCC=/opt/FriendlyARM/toolschain/4.4.3/bin/arm-linux-gccrnAR=/opt/FriendlyARM/toolschain/4.4.3/bin/arm-linux-ar rcsrnRANLIB=/opt/FriendlyARM/toolschain/4.4.3/bin/arm-linux-ranlibrnrn然后:make,make installrnrnjiaoben2:rn************************************************************************************rn#/bin/shrnBIN=/opt/FriendlyARM/toolschain/4.4.3rnTAR=/root/mymad/libzrnrncd /root/mymad/rnrnchmod -R 777 libid3tag-0.15.1brnchmod -R 777 libmad-0.15.1brnchmod -R 777 madplay-0.15.2brnrncd /root/mymad/libid3tag-0.15.1brn./configure CC=$BIN/bin/arm-linux-gcc --prefix=$TAR --host=arm-linux --disable-shared CPPFLAGSrn=-I$TAR/include LDFLAGS=-L$TAR/librnmake;make installrnrncd /root/mymad/libmad-0.15.1brn./configure CC=$BIN/bin/arm-linux-gcc --prefix=$TAR --host=arm-linux --disable-shared CPPFLAGSrn=-I$TAR/include LDFLAGS=-L$TAR/librn****************************************************************************************rn手动 修改Makefile 删除-fforce-memrn然后:make,make installrnrnjiaoben3:rn****************************************************************************************rn#/bin/shrnBIN=/opt/FriendlyARM/toolschain/4.4.3rnTAR=/root/mymad/libzrnrnchmod -R 777 /root/mymad/rnrncd /root/mymad/madplay-0.15.2brn./configure CC=$BIN/bin/arm-linux-gcc --prefix=$TAR --host=arm-linux --disable-shared --enable-static CPPFLAGS=-I$TAR/include LDFLAGS=-L$TAR/librnmake;rn**********************************************************************************************rn[/code]rn最后编译生成的madplay有500Krn[code=Assembly]rn-rwxr-xr-x 1 root root 597434 2011-04-15 16:53 madplayrn[/code]rn下到s3c6410上之后rn./madplay a.mp3rnrn结果为:rn/bin/sh: ./madplay: not foundrnrn请问这是怎么回事啊 我是个新手 谢谢大家 论坛

没有更多推荐了,返回首页