Added gitignore entries needed to ignore derived objects generated from full build...
[bash.git] / examples / functions / ksh-compat-test
blobfeee965d5c5a8e60f2678b6246a431623544665e
2 # replacements for test/[ that do arithmetic expansion on the operands to
3 # the arithmetic operators, like ksh.
5 function test()
7         local -i n1 n3
8         case "$#" in
9         3)      case "$2" in
10                 -lt|-gt|-eq|-ne|-le|-ge)        n1=$(( $1 ))
11                                                 n3=$(( $3 ))
12                                                 builtin test "$n1" $2 "$n3"
13                                                 return $?;;
14                 *)      builtin test "$@" ;;
15                 esac;;                                                          
16         *)      builtin test "$@" ;;
17         esac
20 function [()
22         local -i n1 n3
23         case "$#" in
24         4)      case "$2" in
25                 -lt|-gt|-eq|-ne|-le|-ge)        n1=$(( $1 ))
26                                                 n3=$(( $3 ))
27                                                 builtin [ "$n1" $2 "$n3" ]
28                                                 return $?;;
29                 *)      builtin [ "$@" ;;
30                 esac;;                                                          
31         *)      builtin [ "$@" ;;
32         esac
35 q=7
37 [ q -lt 10 ]
38 echo $?
39 [ $q -lt 10 ]
40 echo $?