一、初识Shell

初识Shell

  1. shell是linux系统内核的一个外壳程序。
  2. 查看当前的shell工具

    echo $BASH

    输出

    image

    表示当前是一个bash的环境。

  3. 编写第一个shell脚本 firsh_shell.sh

    #!/bin/bash
    #FileName: first_shell.sh
    #Use: auto echo Hello World!
    #By authors: wl_it 2020.05.05
    
    echo "Hello World!" 

    保存并修改执行权限 chmod u+x firsh_shell.sh

    或者不改权限 使用 /bin/bash first_shell.sh 执行

    说明:
    #!/bin/bash 固定写法 表示脚本执行程序的路径

    #FileName: first_shell.sh
    #Use: auto echo Hello World!
    #By authors wl_it 2020.05.05

    上面三行是注释

    echo "Hello World!" 真正的命令

评论

暂无评论