#!/bin/sh
aaa(){
len="${#@}"
((s=0))
for i in ${@}
do
((s+=$i))
done
echo $s
}
a=$(aaa 1 2 3 4 5)
((b=$(aaa 1 2 3 4 5)+1))
((c=a+1))
d=a+1
echo ">> $a <<"
echo ">> $b <<"
echo ">> $c <<"
echo ">> $d <<"
결과
>> 15 <<
>> 16 <<
>> 16 <<
>> a+1 <<
aaa(){
len="${#@}"
((s=0))
for i in ${@}
do
((s+=$i))
done
echo $s
}
a=$(aaa 1 2 3 4 5)
((b=$(aaa 1 2 3 4 5)+1))
((c=a+1))
d=a+1
echo ">> $a <<"
echo ">> $b <<"
echo ">> $c <<"
echo ">> $d <<"
결과
>> 15 <<
>> 16 <<
>> 16 <<
>> a+1 <<