美文网首页
Linux学习-Shell基础-脚本执行方式

Linux学习-Shell基础-脚本执行方式

作者: 小笨笨的花花 | 来源:发表于2020-05-02 12:57 被阅读0次
    • echo输出命令
      echo 输入的值
      -e 支持反斜线控制的字符转行
    反斜杠
    • 例子
      echo -e "ab\bc"

    • 第一个脚本


      hello.sh

      1 写完整的注释
      2 shell脚本的注释需要加 上"#!/bin/bash"

    • 脚本执行
      1 赋予执行权限,直接运行--较习惯?

      ls -l hello.sh
      权限原来为,644-755 均增加了x权限
      chmod 755 hello.sh
      ./hello.sh

      可执行程序,必须绝对路径只是或者相对路径执行
      2 通过bash直接调用执行脚本
      bash hello.sh - Linux当中命令是没有大写的

    • 1 cat -A 文件命令 查看所有,包括特殊字符。。
      2 Linux和window中回车符不同
      3 dos2unix hello.sh 将文件中dos的格式换成linux格式
      4 yum -y install dos2unix 安装dos2unix
      5 用shell写,格罗斯方块。

    相关文章

      网友评论

          本文标题:Linux学习-Shell基础-脚本执行方式

          本文链接:https://www.haomeiwen.com/subject/mykkghtx.html