Debian Codegraph @

return-test.sh

raw symbols SCIP
1 #!/bin/bashscip-shell filesystem . . `/bin/bash`.
2 # return-test.sh
3
4 # The largest positive value a function can return is 255.
5
6 return_testscip-shell shell abs-guide 10-4 return_test(). () # Returns whatever passed to it.
7 {
8 return $1
9 }
10
11 return_testscip-shell shell abs-guide 10-4 return_test(). 27 # o.k.
12 echoscip-shell system . . echo. $? # Returns 27.
13
14 return_testscip-shell shell abs-guide 10-4 return_test(). 255 # Still o.k.
15 echoscip-shell system . . echo. $? # Returns 255.
16
17 return_testscip-shell shell abs-guide 10-4 return_test(). 257 # Error!
18 echoscip-shell system . . echo. $? # Returns 1 (return code for miscellaneous error).
19
20 # =========================================================
21 return_testscip-shell shell abs-guide 10-4 return_test(). -151896 # Do large negative numbers work?
22 echoscip-shell system . . echo. $? # Will this return -151896?
23 # No! It returns 168.
24 # Version of Bash before 2.05b permitted
25 #+ large negative integer return values.
26 # It happened to be a useful feature.
27 # Newer versions of Bash unfortunately plug this loophole.
28 # This may break older scripts.
29 # Caution!
30 # =========================================================
31
32 exit 0