1

I have the following function:

func() {
   echo any
   return 3;
}

when I execute this funtion in the following ways, and then I display the returned value of the function with echo $? I got 0 and not 3:

Linux# x=`func`
Linux# echo $?
0
Linux# x=`eval func`
Linux# echo $?
0
Linux# x=$(eval func)
Linux# echo $?
0

How I can got the returned value of func in the above cases?

4

0 回答 0