bash 有两种运行模式,一个是交互式、一个是非交互式。
其中命令的运行有多种模式:
●一条命令、或者赋值
●管道
●列表(command1 && command2、command1 && command2)
●复合命令
复合命令,如表
| key | 形式 | 解释 |
|---|---|---|
| ( ) | (list) | 在子shell中执行 |
| { } | { list; } | 在当前shell中执行 |
| (( )) | ((expression)) | 当表达式非零,返回值是0;否则是1 |
| ` ` | ` expression ` | |
| for | for name [ in [ word ... ] ] do list done | 展开 in 后的项目,生成项目列表。name 依次设置成项目列表元素,而后执行 list。直到 name 获取了空的列表项目。 当省略 in 时…… |
| for | for ((expr1; expr2; expr3)) do list done | 参考C语言的语法 |
| select | select name [ in word ] do list done | 展开 in 后的项目,生成项目列表。 |
| case | case word in | |
| if | if list; then list; [ elif list; then list; ] ... [ else list; ] fi | |
| while | while list-1; do list-2; done | |
| until | until list-1; do list-2; done |

















