develog

[Linux] shell script, function return number 본문

OS & Shell/Linux

[Linux] shell script, function return number

냐옴 2015. 1. 9. 15:08

소스, test.sh

#/bin/bash

getSum(){
        num1=$1
        num2=$2
        let "num = $num1 + $num2"
        return $num
}

getSum 11 22
retVal=$?
echo $retVal


실행결과, ./test.sh

33


Comments