Whamcloud - gitweb
b=12977
authorbrian <brian>
Thu, 26 Jul 2007 04:18:41 +0000 (04:18 +0000)
committerbrian <brian>
Thu, 26 Jul 2007 04:18:41 +0000 (04:18 +0000)
r=mjmac
r=yujian

If anything inside the "while read; do ... done" loop (or it's callees)
reads from stdin (a very common thing to do) it will consume input meant
for the read since it's reading from stdin with ${CSV_FILE} being
redirected to stdin.  Read on another file descriptor to avoid this.

lustre/scripts/lustre_config.in

index c89dca4..0f849fe 100644 (file)
@@ -755,7 +755,8 @@ get_items() {
     declare -i line_num=0
     declare -i idx=0
 
-    while read -r LINE; do
+    exec 9< ${CSV_FILE}
+    while read -u 9 -r LINE; do
         line_num=${line_num}+1
         # verbose_output "Parsing line ${line_num}: $LINE"
 
@@ -820,7 +821,7 @@ get_items() {
         fi
 
         idx=${idx}+1
-    done < ${CSV_FILE}
+    done
 
     return 0
 }