Linux执行.sh文件,提示No such file or directory的问题的解决方法

12-06-28 16:59作者:love__coder

Linux执行.sh文件,提示No such file or directory的问题

问题描述

解决方法

分析原因,可能因为我平台迁移碰到权限问题我们来进行权限转换

1)在Windows下转换:

利用一些编辑器如UltraEdit或EditPlus等工具先将脚本编码转换,再放到Linux中执行。转换方式如下(UltraEdit):File-->Conversions-->DOS->UNIX即可。

2)方法

用vim打开该sh文件,输入:

[plain]

:set ff

回车,显示fileformat=dos,重新设置下(www.111cn.net)文件格式:

[plain]

:set ff=unix

保存退出:

[plain]

:wq

再执行,竟然可以了

3)在linux中的权限转换

也可在Linux中转换:

首先要确保文件有可执行权限

#chmod u+x filename

然后修改文件格式

#vi filename

三种方法都可以方便快速的解决关于Linux执行.sh文件,提示No such file or directory这个问题了。

在window平台下,写好shell脚本文件,迁移到linux平台,赋过可执行权限,执行该sh文件,

却提示No such file or directory。ls 了下,确实有该文件,怎么会事呢,

难道是文件格式兼容性问题?用vim打开该sh文件,输入:

[plain]

:set ff

回车,显示fileformat=dos,重新设置下文件格式:

[plain]

:set ff=unix

保存退出:

[plain]

:wq  Linux执行.sh文件,提示No such file or directory的问题的解决方法

12-06-28 16:59作者:love__coder

Linux执行.sh文件,提示No such file or directory的问题

问题描述

解决方法

分析原因,可能因为我平台迁移碰到权限问题我们来进行权限转换

1)在Windows下转换:

利用一些编辑器如UltraEdit或EditPlus等工具先将脚本编码转换,再放到Linux中执行。转换方式如下(UltraEdit):File-->Conversions-->DOS->UNIX即可。

2)方法

用vim打开该sh文件,输入:

[plain]

:set ff

回车,显示fileformat=dos,重新设置下(www.111cn.net)文件格式:

[plain]

:set ff=unix

保存退出:

[plain]

:wq

再执行,竟然可以了

3)在linux中的权限转换

也可在Linux中转换:

首先要确保文件有可执行权限

#chmod u+x filename

然后修改文件格式

#vi filename

三种方法都可以方便快速的解决关于Linux执行.sh文件,提示No such file or directory这个问题了。

在window平台下,写好shell脚本文件,迁移到linux平台,赋过可执行权限,执行该sh文件,

却提示No such file or directory。ls 了下,确实有该文件,怎么会事呢,

难道是文件格式兼容性问题?用vim打开该sh文件,输入:

[plain]

:set ff

回车,显示fileformat=dos,重新设置下文件格式:

[plain]

:set ff=unix

保存退出:

[plain]

:wq

再执行,竟然可以了。这个事情又给我提了次醒,程序尽量在linux下编写,迁移时,也许会少很多问题。

再执行,竟然可以了。这个事情又给我提了次醒,程序尽量在linux下编写,迁移时,也许会少很多问题。

linux sh文件提示 no such file or directory的更多相关文章

  1. Linux执行.sh文件,提示No such file or directory的问题的解决方法

    亲测有效:http://www.jb51.net/LINUXjishu/56395.html Linux执行.sh文件,提示No such file or directory的问题的解决方法 在win ...

  2. Linux执行.sh文件,提示No such file or directory的问题

    问题描述 在window平台下,写好shell脚本文件,迁移到linux平台,赋过可执行权限,执行该sh文件,却提示NO such file or directory 解决方案 难道是文件格式兼容性问 ...

  3. linux执行python的脚本文件,提示提示No such file or directory

    在window平台下,写好python脚本文件,迁移到linux平台,赋过可执行权限,执行该sh文件,却提示No such file or directory.ls 了下,确实有该文件,怎么会事呢, ...

  4. linux 下执行.sh文件提示permission denied

    linux 下执行.sh文件提示permission denied 在脚本文件目录下运行命令,赋予权限: chmod 777 *.sh or chmod +x  *.sh

  5. Linux运行shell脚本提示No such file or directory错误的解决办法

    Linux执行.sh文件,提示No such file or directory的问题: 原因:在windows中写好shell脚本测试正常,但是上传到 Linux 上以脚本方式运行命令时提示No s ...

  6. Linux学习笔记之Linux shell脚本运行出现问题:bash: ./test: bin/sh: bad interpreter: No such file or directory

    问题: 在Linux系统中使用“vi test.sh”命令创建.sh文件,保存文件(:wq)并赋予权限(chmod +x test.sh)后,执行(./test.sh),出现问题:“bash: ./t ...

  7. 解决“运行arm-linux-gcc命令,提示No such file or directory”的问题

    今天在ubuntu14.04上安装arm的交叉编译器arm-linux-gcc,环境变量配置好以后,运行arm-linux-gcc命令,总提示No such file or directory.然后去 ...

  8. ITouch在xcode下提示‘No such file or directory, at ‘/SourceCache/DVTi...'

    版权声明:本文为博主原创文章,转载或又一次发表请先与我联系. https://blog.csdn.net/jonahzheng/article/details/37692733       用一个台老 ...

  9. shell 执行提示No such file or directory

    问题描述: 项目开发过程中ansible执行脚本失败,单独运行shell脚本提示:No such file or directory,脚本结构执行脚本a 调用另一脚本b, 但查看b脚本路径正确不存在找 ...

随机推荐

  1. 互评Beta版本

    作业要求[https://edu.cnblogs.com/campus/nenu/2018fall/homework/2448] 基于NABCD评论作品,及改进建议 1.杨老师粉丝群.作品:<P ...

  2. mysql-connector-java-3.1.10-bin-g.jar 和 mysql-connector-java-3.1.10-bin.jar两个文件有什么不同呀?

    MySQL Connector/J的文档里说: MySQL Connector/J is distributed as a .zip or .tar.gz archive containing the ...

  3. Python decode和encody

    s = "我今天非常的困" bs = s.encode("utf-8")# 把字符串转化成utf-8格式bytes # bytes 不是给人看的, 给机器用的 ...

  4. Python bool值

    a = 10 print(type(a)) #<class 'int'> d = str(a) #把数字转换成str print(type(d)) #<class 'str'> ...

  5. 微信小程序插件使用

    使用插件 小程序开发者可便捷地把插件添加到自己的小程序内,丰富小程序的服务.当用户在使用小程序时,将可以在小程序内使用插件提供的服务. 开放范围 所有小程序 接入流程 在小程序管理后台添加插件 小程序 ...

  6. tensorflow中的参数初始化方法

    1. 初始化为常量 tf中使用tf.constant_initializer(value)类生成一个初始值为常量value的tensor对象. constant_initializer类的构造函数定义 ...

  7. linux配置禁用启用IPv6

    IPv6被认为是IPv4的替代产品,它用来解决现有IPv4地址空间即将耗尽的问题.但目前,开启IPv6可能会导致一些问题.因此有时我们需要关闭IPv6.下面是IPv6的关闭方法应该适用于所有主流的Li ...

  8. Binary file to C array(bin2c)

    /******************************************************************************** * Binary file to C ...

  9. word2vec 小测试

    Bag-of-words Model Previous state-of-the-art document representations were based on the bag-of-words ...

  10. 51Nod:活动安排问题(区间问题)

    X轴上有N条线段,每条线段有1个起点S和终点E.最多能够选出多少条互不重叠的线段.(注:起点或终点重叠,不算重叠). 例如:[1 5][2 3][3 6],可以选[2 3][3 6],这2条线段互不重 ...