Sfoglia il codice sorgente

never ending quest for portable bash scripts

Matt Coles 8 anni fa
parent
commit
faee9f9ac1
1 ha cambiato i file con 6 aggiunte e 6 eliminazioni
  1. 6 6
      cw/tests/test.sh

+ 6 - 6
cw/tests/test.sh

@@ -1,6 +1,6 @@
1 1
 #/bin/bash
2 2
 uname=`uname`
3
-if [[ "$uname" -eq "Darwin" ]]; then
3
+if [ "$uname" = "Darwin" ]; then
4 4
   date="gdate"
5 5
   readlink="greadlink"
6 6
 else
@@ -26,35 +26,35 @@ overall='0'
26 26
 pass="\033[32mPASSED\033[0m"
27 27
 fail="\033[31mFAILED\033[0m"
28 28
 
29
-if [[ "$ret_only" -eq $ret_ans ]]; then
29
+if [ "$ret_only" -eq $ret_ans ]; then
30 30
   echo "return_only ... $pass"
31 31
 else
32 32
   echo -n "return_only ... $fail"
33 33
   echo " expected $ret_ans but got $ret_only"
34 34
   overall='1'
35 35
 fi
36
-if [[ "$var_maths" -eq $var_ans ]]; then
36
+if [ "$var_maths" -eq $var_ans ]; then
37 37
   echo "var_maths ..... $pass"
38 38
 else
39 39
   echo "var_maths ..... $fail"
40 40
   echo " expected $var_ans but got $var_maths"
41 41
   overall='1'
42 42
 fi
43
-if [[ "$func_call" -eq $func_ans ]]; then
43
+if [ "$func_call" -eq $func_ans ]; then
44 44
   echo "func_call ..... $pass"
45 45
 else
46 46
   echo -n "func_call ..... $fail"
47 47
   echo " expected $func_ans but got $func_call"
48 48
   overall='1'
49 49
 fi
50
-if [[ "$cond_loop" -eq $cond_ans ]]; then
50
+if [ "$cond_loop" -eq $cond_ans ]; then
51 51
   echo "cond_loop ..... $pass"
52 52
 else
53 53
   echo -n "cond_loop ..... $fail"
54 54
   echo " expected $cond_ans but got $cond_loop"
55 55
   overall='1'
56 56
 fi
57
-if [[ "$func_args" -eq $args_ans ]]; then
57
+if [ "$func_args" -eq $args_ans ]; then
58 58
   echo "func_args ..... $pass"
59 59
 else
60 60
   echo -n "func_args ..... $fail"