Bash 脚本编程

时间:2020-06-30 21:22:12   收藏:0   阅读:50

概述

shell语法

变量

echo命令

echo命令

重定向

管道

[time [-p]] [ ! ] command [ | command2 ... ]
ps -A | grep firefox

for 语句

for循环的格式为

for name [ in word ] ;
do
	list ;
done

其中循环格式可以为

或者可以使用类似c++的语法,

for (( i = 1 ; i <= n ; i++ )) ;
do
    list ;
done

while 语句

while循环的格式为

cnt=0
while [ $cnt -lt 10]
do
    echo "$cnt"
    let cnt+=1
done

其中,-lt的意思为less than,即<=

了解更多

原文:https://www.cnblogs.com/hellohhy/p/13215320.html

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