Shell编程

  • shell编程

1.什么是shell

shell是用户与内核进行交互操作的一种接口,目前最流行的shell称为bash shell

shell也是一门编程语言,<解释性编程语言>,即shell脚本

一个系统可以存在多个shell,可以通过cat /etc/shells 命令查看系统中安装的shell,不同的shell可能支持的命令语法不同

2.shell脚本的执行方式

第一种:

输入脚本的绝对路径或者相对路径,首先要赋予+x权限

  /root/helloworld.sh

  ./helloworld.sh

或者,不用+x权限,而用解释器解释执行

  sh helloworld.sh

第二种:

bash或者sh+脚本

sh /root/helloworld.sh

sh helloworld.sh

  • sed命令

  • awk命令

  • crontab定时器

原文地址:https://www.cnblogs.com/gengsc/p/6746645.html