1 shell是什么

它是一种脚本语言,并非编程语言
可以使用一些逻辑判断、循环等语法
可以自定义子函数
是系统命令的集合

2 shell 的编程格式:

  1. #!/bin/bash shell脚本的第一句
  2. ##The first test shell script. 介绍这个shell脚本的作用
  3. ##Written by yanlong. 由谁写的

3 如何执行shell脚本

  1. **① bash/sh 脚本名 ** eg: bash yl.h<br /> -x 一步一步看到执行脚本过程 eg: bash -x yl.h
  2. **② 给这个脚本加上x权限 chmod +x yl.sh**<br /> /tmp/yl.sh

4 两个内嵌的shell参数传递

  1. cat xiao.sh
  2. sh bai.sh $*
  3. cat bai.sh
  4. for i in $*
  5. do
  6. echo $i
  7. done
  8. ###执行
  9. sh xiao.sh a b x