代码1:
#!/bin/bash
function myfunc()
{
echo "hello world"
}
myfunc#函数调用
代码2:
#!/bin/bash
set -xv #x显示脚本执行过程,v脚本执行代码屏显。
#函数体在函数调用之前--正确写法
function sum()
{
s=0;
s=$[$1+$2];
echo $s;
}
read -t 5 -p "Pls input your parameter 1:" p1
read -t 5 -p "Pls input your parameter 2:" p2
sum $p1 $p2
~
代码3: