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. PHP:第三章——PHP中返回引用的函数

    <?php header("Content-Type:text/html;charset=utf-8"); $i=1; function &F(){ global $ ...

  2. jsoupa-解析遍历一个HTML

    解析个遍历一个HTML文档 String html ="<html><head><title>First parse</title></ ...

  3. web 攻击靶机解题过程

    sql注入靶机攻击过程请参考 https://pentesterlab.com/exercises/from_sqli_to_shell/course http://www.sohu.com/a/12 ...

  4. iOS工程中如何去掉第三方的警告

    一)第一种方法 在工程中有警告的地方,右键选择Review in log,然后就能看到类似[Wnonnull]这样的警告, 然后在工程buildSettings中的Other Warning Flag ...

  5. 详细介绍C++STL:unordered_map

    不得不提一下,hash_map未加入在C++11标准中. 在VC中编译: #include <hash_map> using namespace stdext; hash_map<i ...

  6. SWIFT Optional Value

    SWIFT中有一个类型定义叫可选值,在变量类型后面加一个?号即可定义一个类型为Optional Value的变量,当在使用变量时要用到强制解包!. 如在页面上有一个可选输入年龄的框,在接受数据的时间就 ...

  7. preprocessor设置调试宏

    调试宏:preprocessor设置 预处理器“调试”宏在Xcode项目模板的调试版本定义.预处理宏在编译时被解释和调试宏可以用来允许调试代码运行在调试版本中你的项目.如果你不确定你的项目已经确定,可 ...

  8. 【opencv基础】Rect类的神奇用法

    前言 最近看github上源码发现对两个cv::Rect使用相与(&)操作,猛地感觉自己蒙啦,Rect类还有这种神奇用法?!翻看opencv官网Rect类,果然如此! opencv中Rect类 ...

  9. IP地址 无限网卡的MAC地址

  10. USB gadget 驱动 printer.c 分析

    1. modprobe g_printer idVendor=0x0525 idProduct=0xa4a8 modprobe后面也可以加模块参数 2. prn_example从stdout获取数据然 ...