Shell编程学习之函数
shell编程学习之函数
1、创建函数和使用函数
-bash-3.2# cat test.sh
#!/bin/bash
hello ()
{
i=1
until [ $i -gt 5 ]
do
echo $i
let i++
done
}
hello
-bash-3.2# sh test.sh
1
2
3
4
5
2、反回值
#!/bin/bash
hello ()
{
i=1
until [ $i -gt 5 ]
do
echo $i
let i++
done
}
hello
echo $?
-bash-3.2# sh test.sh
1
2
3
4
5
0
相关推荐
firefaith 2020-10-30
以梦为马不负韶华 2020-10-20
wangzhaotongalex 2020-09-22
jarrygao 2020-11-02
woaimeinuo 2020-10-21
laisean 2020-09-01
libao 2020-09-16
卖口粥湛蓝的天空 2020-09-15
fsfsdfsdw 2020-04-22
gcong 2020-04-10
赵家小少爷 2020-01-14
liuyh 2020-08-09
higheels 2020-06-26
thickbookszone 2020-06-14
xiaonamylove 2020-06-14
大牛牛 2020-06-14
firefaith 2020-06-14
bigNoseLiu 2020-06-10