Browse Source

piping added and resolved the conflicts

pv2k 7 years ago
parent
commit
80123d312d
1 changed files with 22 additions and 15 deletions
  1. 22
    15
      pert

+ 22
- 15
pert View File

@@ -67,7 +67,8 @@ function pert_table
67 67
     total_estimate=0
68 68
     total_standard_deviation=0
69 69
     total_variance=0
70
-    for var in "$@"; do
70
+    time=("$@")
71
+    for var in "${time[@]}"; do
71 72
 
72 73
         # counter iterator
73 74
         counter=$[$counter +1]
@@ -146,18 +147,24 @@ function pert_table
146 147
 
147 148
 
148 149
 # main
149
-if [ $# -eq 0 ]; then
150
-    _help
151
-    exit 1
152
-fi
150
+if [ ! -t 0 ];then
151
+    time=$(cat -)
152
+    pert_table ${time[@]}
153
+else
154
+    if [ $# -eq 0 ]; then
155
+        _help
156
+        exit 1
157
+    fi
153 158
 
154
-case "$1" in
155
-  *help|*h)
156
-    _help
157
-    exit 1
158
-    ;;
159
-  *)
160
-    pert_table $@
161
-    exit 0
162
-    ;;
163
-esac
159
+    case "$1" in
160
+      *help|*h)
161
+        _help
162
+        exit 1
163
+        ;;
164
+      *)
165
+
166
+        pert_table $@
167
+        exit 0
168
+        ;;
169
+    esac
170
+fi

Loading…
Cancel
Save