**
shell 中使用cd命令,提示找不到目录的解决方法
**
在linux中将多个php命令写到同一个sh文件中执行
#!/bin/bash/
cd /www/sf/
/usr/local/bin/php xxx.php
/usr/local/bin/php xxx1.php
/usr/local/bin/php xxx2.php
- 1
- 2
- 3
- 4
- 5
``
然后执行命令
sh xxx.sh
- 1
有的时候会出现 找不到/www/sf/
目录
为什么呢,找了下资料,是因为linux和windows下的回车换行符号不一致导致的出错。
也就是说文件的格式有问题
解决方案
vim xxx.sh
- 1
// 查看格式
:set ff
- 1
// 设置格式
:set ff=unix
- 1
fileformats[ffs](Vim 才有) 可指定多个,会依加载的档案形式来调整 ff。 例如 :
set ffs=unix,dos ff=unix
- 1
则预设为 unix 格式,但如读入的是 dos 格式的档案,会自动调整为 dos 格式,这样存盘时就会以 dos 格式存盘(状态列会显示)。。此时如要改成 unix 格式,可 :set ff=unix 然后存盘就会转成 unix 格式,反之亦然。
图片:
如何插入一段漂亮的代码片
作者:沫沫
欢迎大家和我交流技术性问题
QQ:1348612681
https://www.runoob.com/mysql/mysql-install.html
https://www.jianshu.com/p/276d59cbc529
</div><div data-report-view="{"mod":"1585297308_001","dest":"https://blog.csdn.net/weixin_42712724/article/details/86480568","extend1":"pc"}"><div></div></div>
<link href="https://csdnimg.cn/release/phoenix/mdeditor/markdown_views-60ecaf1f42.css" rel="stylesheet">
<div class="more-toolbox">
<div class="left-toolbox">
<ul class="toolbox-list">
<li class="tool-item tool-active is-like "><a href="javascript:;"><svg class="icon" aria-hidden="true">
<use xlink:href="#csdnc-thumbsup"></use>
</svg><span class="name">点赞</span>
<span class="count">2</span>
</a></li>
<li class="tool-item tool-active is-collection "><a href="javascript:;" data-report-click="{"mod":"popu_824"}"><svg class="icon" aria-hidden="true">
<use xlink:href="#icon-csdnc-Collection-G"></use>
</svg><span class="name">收藏</span></a></li>
<li class="tool-item tool-active is-share"><a href="javascript:;" data-report-click="{"mod":"1582594662_002"}"><svg class="icon" aria-hidden="true">
<use xlink:href="#icon-csdnc-fenxiang"></use>
</svg>分享</a></li>
<!--打赏开始-->
<!--打赏结束-->
<li class="tool-item tool-more">
<a>
<svg t="1575545411852" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="5717" xmlns:xlink="http://www.w3.org/1999/xlink" width="200" height="200"><defs><style type="text/css"></style></defs><path d="M179.176 499.222m-113.245 0a113.245 113.245 0 1 0 226.49 0 113.245 113.245 0 1 0-226.49 0Z" p-id="5718"></path><path d="M509.684 499.222m-113.245 0a113.245 113.245 0 1 0 226.49 0 113.245 113.245 0 1 0-226.49 0Z" p-id="5719"></path><path d="M846.175 499.222m-113.245 0a113.245 113.245 0 1 0 226.49 0 113.245 113.245 0 1 0-226.49 0Z" p-id="5720"></path></svg>
</a>
<ul class="more-box">
<li class="item"><a class="article-report">文章举报</a></li>
</ul>
</li>
</ul>
</div>
</div>
<div class="person-messagebox">
<div class="left-message"><a href="https://blog.csdn.net/weixin_42712724">
<img src="https://profile.csdnimg.cn/9/C/8/3_weixin_42712724" class="avatar_pic" username="weixin_42712724">
<img src="https://g.csdnimg.cn/static/user-reg-year/2x/2.png" class="user-years">
</a></div>
<div class="middle-message">
<div class="title"><span class="tit"><a href="https://blog.csdn.net/weixin_42712724" data-report-click="{"mod":"popu_379"}" target="_blank">笙沫</a></span>
</div>
<div class="text"><span>发布了11 篇原创文章</span> · <span>获赞 5</span> · <span>访问量 3565</span></div>
</div>
<div class="right-message">
<a href="https://im.csdn.net/im/main.html?userName=weixin_42712724" target="_blank" class="btn btn-sm btn-red-hollow bt-button personal-letter">私信
</a>
<a class="btn btn-sm bt-button personal-watch" data-report-click="{"mod":"popu_379"}">关注</a>
</div>
</div>
</div>
</article>