Linux中有好多中不同的shell,bash是linux默认的shell,免费且容易使用。

su切换为root权限

1.创建shell脚本

touch hello.sh

 

2.编辑:

vi hello.sh

内容

#! /bin/bash
#the first program echo
"hello world"

 

3.保存并退出

按Esc取消插入,输入:wq保存 

 

==================

可以使用bash运行hello.sh

==================

4.赋予执行权限

chmod 755 hello.sh

 755/u+x

5.直接运行

./hello.sh

过程:

编写第一个Shell脚本

 

相关文章:

  • 2021-11-04
  • 2021-04-29
  • 2022-03-04
猜你喜欢
  • 2022-12-23
  • 2021-09-01
  • 2021-11-28
  • 2021-11-28
  • 2021-12-29
  • 2021-11-28
相关资源
相似解决方案