Procházet zdrojové kódy

never ending quest for portable bash scripts

Matt Coles před 8 roky
rodič
revize
faee9f9ac1
1 změnil soubory, kde provedl 6 přidání a 6 odebrání
  1. 6 6
      cw/tests/test.sh

+ 6 - 6
cw/tests/test.sh

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