#!/bin/bash
fact()
{
local num=$1
if [ "$num" -eq 0 ]
then
fact=1
else
let "decnum=num-1"
fact $decnum
let "fact=$num*$?"
fi
return $fact
}
fact $1
echo "fact of $1 is $?"
exit 0
为何执行该脚本会有如下报错呢
./fun27.sh: line 5: [: : integer expression expected
Segmentation fault
侃侃尔雅
扬帆大鱼