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,7 +12,6 @@ if [ -z "$1" ] || [[ "$1" =~ [-]*(help|h) ]]; then
12 12
     exit 1
13 13
 fi
14 14
 
15
-# helper
16 15
 function _calc 
17 16
 {
18 17
     scale=2
@@ -30,6 +29,12 @@ function _divider
30 29
 
31 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 38
 counter=0
34 39
 total_estimate=0
35 40
 total_standard_deviation=0
@@ -51,14 +56,6 @@ for var in "$@"; do
51 56
     # pessimistic value
52 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 59
     # check values
63 60
     if [ -z "$o" ] || [ -z "$r" ] || [ -z "$p" ]; then
64 61
         printf "$format" "$counter. bad input" $o $r $p
@@ -82,10 +79,11 @@ for var in "$@"; do
82 79
 
83 80
 done
84 81
 
85
-if [[ $total_estimate > 0 ]]; then
82
+_divider
86 83
 
84
+if [[ $total_estimate > 0 ]]; then
85
+    
87 86
     # footer        
88
-    _divider
89 87
     printf "$format" "summary" "-" "-" "-" $total_estimate $total_standard_deviation $total_variance
90 88
     _divider
91 89
     

Loading…
Cancel
Save