shell [ 函数的一些用法 continue, 点. ]

#!/bin/bash

i="glo"

foo() {
	local i="loc"
	echo "Fun haha hhehe"
	echo $i
}

echo $i

foo

echo $i

exit 0
#!/bin/bash

rm -rf fred*
echo > fred1
echo > fred2

mkdir fred3

echo > fred4

for i in fred*
	do
		if [ -d "$i" ]; then
			break;
		fi
	done

echo hehe was $i
rm -rf fred*
exit 0
#!/bin/bash
rm -f fred
if [ -f fred ]; then
	:
else
	echo file is not exist!
fi

exit 0
#!/bin/bash

rm -rf fred*
echo > fred1
echo > fred2
mkdir fred3
echo > fred4

for i in fred*
	do
		if [ -d "$i" ]; then
			echo "skipping the $i"
			continue;
		fi
		echo file is $i
	done

rm -rf fred*

exit 0

点 . 命令用于在当前 shell 中执行命令! 

用 点. 命令执行这使得脚本程序可以改变当前 shell 中的环境设置,即使脚本程序执行结束后,这些改变仍然有效!



评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值