linux sh文件提示 no such file or directory
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的更多相关文章
- Linux执行.sh文件,提示No such file or directory的问题的解决方法
亲测有效:http://www.jb51.net/LINUXjishu/56395.html Linux执行.sh文件,提示No such file or directory的问题的解决方法 在win ...
- Linux执行.sh文件,提示No such file or directory的问题
问题描述 在window平台下,写好shell脚本文件,迁移到linux平台,赋过可执行权限,执行该sh文件,却提示NO such file or directory 解决方案 难道是文件格式兼容性问 ...
- linux执行python的脚本文件,提示提示No such file or directory
在window平台下,写好python脚本文件,迁移到linux平台,赋过可执行权限,执行该sh文件,却提示No such file or directory.ls 了下,确实有该文件,怎么会事呢, ...
- linux 下执行.sh文件提示permission denied
linux 下执行.sh文件提示permission denied 在脚本文件目录下运行命令,赋予权限: chmod 777 *.sh or chmod +x *.sh
- Linux运行shell脚本提示No such file or directory错误的解决办法
Linux执行.sh文件,提示No such file or directory的问题: 原因:在windows中写好shell脚本测试正常,但是上传到 Linux 上以脚本方式运行命令时提示No s ...
- 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 ...
- 解决“运行arm-linux-gcc命令,提示No such file or directory”的问题
今天在ubuntu14.04上安装arm的交叉编译器arm-linux-gcc,环境变量配置好以后,运行arm-linux-gcc命令,总提示No such file or directory.然后去 ...
- ITouch在xcode下提示‘No such file or directory, at ‘/SourceCache/DVTi...'
版权声明:本文为博主原创文章,转载或又一次发表请先与我联系. https://blog.csdn.net/jonahzheng/article/details/37692733 用一个台老 ...
- shell 执行提示No such file or directory
问题描述: 项目开发过程中ansible执行脚本失败,单独运行shell脚本提示:No such file or directory,脚本结构执行脚本a 调用另一脚本b, 但查看b脚本路径正确不存在找 ...
随机推荐
- springboot + swagger的实体类属性注解
@Api:用在类上,说明该类的作用 @ApiOperation:用在方法上,说明方法的作用 @ApiImplicitParams:用在方法上包含一组参数说明 @ApiImplicitParam:用在@ ...
- tensoflow学习入门一
对于如何创建图并开启session,参考如下 # -- encoding:utf-8 -- import tensorflow as tf # 定义常量矩阵a和矩阵b a=tf.constant([[ ...
- Error: Chunk.entry was removed. Use hasRuntime()错误解决
Error: Chunk.entry was removed. Use hasRuntime()错误解决 执行如下命令 npm uninstall --save-dev ext ...
- 073——VUE中vuex之使用actions和axios异步初始购物车数据
<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8&quo ...
- NETGEAR WNDR3800CH openwrt 不能用新版, Barrier Breaker 14.07
15系列主要是不能正常端口映射,这个很不方便了. 尽管80端口被封了,我们可以用别的端口啊. 刷完以后,不懂英文的,跟着下面的步骤就可以进入中文环境了. 记得先上网,再通过路由下载安装中文包,才可以. ...
- Memcached 扩展常用方法
保存数据 向memcached保存数据的方法有 add replace set 它们的使用方法都相同: $add = $memcached->add( '键', '值', '期限' ); $re ...
- JS将日期转化为unix时间戳
var str = '2008-10-09 21:35:28';//PHP中对应的UNIX时间戳为1223559328 var new_str = str.replace(/:/g,'-'); new ...
- VS2012调用64位IIS Express
在注册表键HKEY_CURRENT_USER\Software\Microsoft\VisualStudio\11.0\WebProjects下添加DWORD "Use64BitIISExp ...
- python struct模块的使用
struct模块中的函数 函数 return explain pack(fmt,v1,v2…) string 按照给定的格式(fmt),把数据转换成字符串(字节流),并将该字符串返回. pack_in ...
- 导出导入grafana完整的dashboard(非单个图表)
导出很简单,如下图操作即可 导入