return value of function in script
How can i return value of function in bash shell scrit ? I used the S? for obtaining return value. But it does not exceed the 256 limit.
pow $a, $b
echo "the result is $?"
The exit status from functions in bash or other shell scripting languages are not meant to be used like values returned from C functions. While it is possible to do what you suggested. You should use variables or command substitution instead. The exit status obtained using $? is used mainly for flow control. In other words, the function worked do this, otherwise do this.
You may want to post questions like this to the Programming forum where they will get better exposure. This is not specific to RedHat.
|All times are GMT -5. The time now is 04:13 PM.|