![](https://img-blog.csdnimg.cn/20201014180756922.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
shell
文章平均质量分 52
Faith_runner
这个作者很懒,什么都没留下…
展开
-
shell脚本调试
shell脚本调试使用echo命令调试可以使用echo命令在脚本中的打印出重要的变量使用bash命令调试sh [-nvx] scripts.sh-n:不执行脚本,只检查脚本的语法问题,并给出错误提示。-v:执行脚本时,先将脚本内容输出到屏幕上,然后执行脚本,如果有错误,会给出错误提示。-x:执行脚本,并将执行的语句和结果按执行顺序输出到屏幕上,脚本中的语句前会显示+号(PS4变...原创 2019-12-24 17:29:43 · 291 阅读 · 0 评论 -
linux 数据流重定向
数据流stdin:标准输入,代码为0。stdout:standard output,标准输出,指执行命令后返回的正确信息。代码为1。stderr:standard error output,标准错误输出,指执行命令失败后返回的错误信息。代码为2。...原创 2019-11-08 15:58:40 · 188 阅读 · 0 评论 -
linux 遍历目录下的文件
#!/bin/bash#获取文件路径并设置变量dir=`cd /mnt/d/linux/pic ; pwd`for file in $dir/*do echo $filedone参考:遍历文件原创 2017-09-18 16:27:27 · 621 阅读 · 0 评论 -
/bin/bash^M: bad interpreter: No such file or directory
从github clone了一个项目,在执行其中的shell脚本时,遇到了如下报错:/bin/bash^M: bad interpreter: No such file or directory经查阅资料,发现是文件编码的问题。在windows上编辑的文件,格式为dos,在linux中执行,需要转换格式为unix。查看文件编码fileformat 在vim中打开shell脚本,执行 ...原创 2019-09-18 16:07:26 · 212 阅读 · 0 评论