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 @   云云淡淡  阅读(15)  评论(0编辑  收藏  举报
相关博文:
阅读排行:
· TypeScript + Deepseek 打造卜卦网站:技术与玄学的结合
· 阿里巴巴 QwQ-32B真的超越了 DeepSeek R-1吗?
· 【译】Visual Studio 中新的强大生产力特性
· 【设计模式】告别冗长if-else语句:使用策略模式优化代码结构
· AI与.NET技术实操系列(六):基于图像分类模型对图像进行分类
点击右上角即可分享
微信分享提示