#!/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 中的环境设置,即使脚本程序执行结束后,这些改变仍然有效!