posted by Solver Full-stack Developer 2013.11.12 14:39

#!/bin/bash


function intro(){

        echo "swap shell script!"

}


function swapNum(){


        local tmp=$1

        num1=$num2 #call by value

        num2=$tmp


        return 255 #return value is 1byte

}


intro


echo "begin num is $1, $2"


num1=$1

num2=$2


swapNum num1 num2 #call fucntion


echo "result is $?"//return value

echo "artificial num is $num1, $num2"



신고