1. case语句
case 变量 in
模式1)
命令序列;;
模式2)
命令序列2;;
*)
命令序列3
esac
2.alias 定义别名一个名称执行一个复杂的指令
alias egrep='egrep --color=auto'
alias fgrep='fgrep --color=auto'
alias grep='grep --color=auto'
alias l='ls -CF'
alias la='ls -A'
alias ll='ls -alF'
alias ls='ls --color=auto'
多条指令的时候alias不太适用,shell的函数
函数名(){
}
3. sleep 1000 & //到后台睡眠,和wait配合使用
4.
格式2:
函数名(){
命令序列
......
}
格式1:
function 函数名{
命令序列
......
}
5. fork 炸弹
#!/bin/bash
.(){
.|.&
}
.
a(){
a|a&
}
a
6. exit 终止脚本程序
break 跳出循环
continue 结束本次循环,开始下一次循环