Browse Source

default table

arzzen 8 years ago
parent
commit
dff3a11787
1 changed files with 9 additions and 11 deletions
  1. 9
    11
      pert.sh

+ 9
- 11
pert.sh View File

12
     exit 1
12
     exit 1
13
 fi
13
 fi
14
 
14
 
15
-# helper
16
 function _calc 
15
 function _calc 
17
 {
16
 {
18
     scale=2
17
     scale=2
30
 
29
 
31
 format=" | %-12s |%11s |%10s |%12s |%9s |%9s |%9s |\n"
30
 format=" | %-12s |%11s |%10s |%12s |%9s |%9s |%9s |\n"
32
 
31
 
32
+# header
33
+echo -e "\nTasks\n"
34
+_divider
35
+printf "$format" "#" "optimistic" "realistic" "pessimistic" "duration" "risk" "variance"
36
+_divider
37
+
33
 counter=0
38
 counter=0
34
 total_estimate=0
39
 total_estimate=0
35
 total_standard_deviation=0
40
 total_standard_deviation=0
51
     # pessimistic value
56
     # pessimistic value
52
     p=${ADDR[2]}
57
     p=${ADDR[2]}
53
     
58
     
54
-    # header
55
-    if [[ $counter = 1 ]]; then
56
-        echo -e "\nTasks\n"
57
-        _divider
58
-        printf "$format" "#" "optimistic" "realistic" "pessimistic" "duration" "risk" "variance"
59
-        _divider
60
-    fi
61
-    
62
     # check values
59
     # check values
63
     if [ -z "$o" ] || [ -z "$r" ] || [ -z "$p" ]; then
60
     if [ -z "$o" ] || [ -z "$r" ] || [ -z "$p" ]; then
64
         printf "$format" "$counter. bad input" $o $r $p
61
         printf "$format" "$counter. bad input" $o $r $p
82
 
79
 
83
 done
80
 done
84
 
81
 
85
-if [[ $total_estimate > 0 ]]; then
82
+_divider
86
 
83
 
84
+if [[ $total_estimate > 0 ]]; then
85
+    
87
     # footer        
86
     # footer        
88
-    _divider
89
     printf "$format" "summary" "-" "-" "-" $total_estimate $total_standard_deviation $total_variance
87
     printf "$format" "summary" "-" "-" "-" $total_estimate $total_standard_deviation $total_variance
90
     _divider
88
     _divider
91
     
89
     

Loading…
Cancel
Save