Tuesday, January 1, 2013

Shell Script Function can return the value upto 255 example

#!/bin/bash
# The largest positive value a function can return is 255.
return_test ()         # Returns whatever passed to it.
{
  return $1
}
return_test 27         # o.k.
echo $?                # Returns 27.
 
return_test 255        # Still o.k.
echo $?                # Returns 255.
return_test 257        # Error!
echo $?                # Returns 1 (return code for miscellaneous error).
exit 0

OUTPUT :

-bash-3.2$ sh func_return_limit
27
255
1
-bash-3.2$

No comments:

Post a Comment

Oracle EBS: Query to Link OM Order Source with AR Grouping Rules and Attributes

SELECT      hou.name,     rtsa.name "Order Source/Transaction Source",     rtsa.description "Description",     gr1.name ...