shell--基本语法

时间:2021-08-19 14:41:12   收藏:0   阅读:24
  1. 分支
if cond;then
  commands
fi

if cond;then
  commands1
else
  commands2
fi

if cond1;then
  commands1
elif cond2;then
  commands2
else
  commands3
fi

case value in
  case1)
    commands1
  case2)
    commands2
esac
  1. 循环
while cond;do
  commands
done

util cond;do
  commands
done

for var in list;do
  commands
done
  1. 函数
[ function ] funname [()]
{
  commands;
  [return int]
}
  1. 模块引用
. /path/module.sh
source /path/module.sh

原文:https://www.cnblogs.com/ai-tech/p/15160679.html

评论(0
© 2014 bubuko.com 版权所有 - 联系我们:wmxa8@hotmail.com
打开技术之扣,分享程序人生!