shell基础命令

shell基础语法

if

If condition
Then
Elif condition
Then
Else
Then 
Fi

for

For loop in 123
Do
Echo “loop is : $loop ”
Done

函数

demotest()
{
Echo “test”
}
demotest

重定向

使用 >> 追加到文件末尾
shell文件中执行文件../file1.sh文件

#!/bin/bash
. ./test1.sh
或者
Source ./test1.sh
接下来,我们为 test2.sh 添加可执行权限并执行:
chmod +x test2.sh
./test2.sh
posted @ 2024-01-01 09:52  云云淡淡  阅读(39)  评论(0)    收藏  举报