常用shell命令语法__Linux

echo "Hello, world!"

# 这是一行注释

# 条件语句
if [ condition ]; then
    # commands
elif [ condition ]; then
    # commands
else
    # commands
fi

# for循环
for i in {1..5}; do
    # commands
done

# while循环
while [ condition ]; do
    # commands
done

# 函数
function_name() {
    # commands
}

# 退出shell脚本
exit 0

 

 
posted @ 2024-03-21 17:57  Ashe|||^_^  阅读(3)  评论(0编辑  收藏  举报