NetworkGhost
IS-IT--Management
I have the following script
#!/bin/expect
set get_cat [open categories r]
set catlist [split [read $get_cat] \n];
close $get_cat
set incr 0
foreach line $catlist {
set val_i [expr {$incr + 1}]
set prod [lindex $line 0]
set sht_title [lindex $line 1]
set mncat [lindex $line 2]
set catarg [lindex $line 3]
set catarg1 [lindex $line 4]
set mn_url "set fname $prod$sht_title$mncat$val_i
set res_string "v:state=root%7Croot-"
exec wget -q -O $fname v%3Asources=CARE
puts $fname
set incr [expr {$incr + 1}]
set test1 [exec grep -c tot $fname]
puts $test1
set test1 0
}
Problem is when I come across a line count of 0 the script barfs. Here is the output:
$ ./test1.sh
testprodprodtime1
1
testprodprodday2
0
child process exited abnormally
while executing
"exec grep -c tot $fname"
("foreach" body line 14)
invoked from within
"foreach line $catlist {
set val_i [expr {$incr + 1}]
set prod [lindex $line 0]
set sht_title [lindex $line 1]
set mncat [lindex $line 2]
set catarg [l..."
(file "./test1.sh" line 6)
Any ideas? I take this out
set test1 [exec grep -c tot $fname]
puts $test1
set test1 0
and it works fine.
Free Firewall/Network/Systems Support-
#!/bin/expect
set get_cat [open categories r]
set catlist [split [read $get_cat] \n];
close $get_cat
set incr 0
foreach line $catlist {
set val_i [expr {$incr + 1}]
set prod [lindex $line 0]
set sht_title [lindex $line 1]
set mncat [lindex $line 2]
set catarg [lindex $line 3]
set catarg1 [lindex $line 4]
set mn_url "set fname $prod$sht_title$mncat$val_i
set res_string "v:state=root%7Croot-"
exec wget -q -O $fname v%3Asources=CARE
puts $fname
set incr [expr {$incr + 1}]
set test1 [exec grep -c tot $fname]
puts $test1
set test1 0
}
Problem is when I come across a line count of 0 the script barfs. Here is the output:
$ ./test1.sh
testprodprodtime1
1
testprodprodday2
0
child process exited abnormally
while executing
"exec grep -c tot $fname"
("foreach" body line 14)
invoked from within
"foreach line $catlist {
set val_i [expr {$incr + 1}]
set prod [lindex $line 0]
set sht_title [lindex $line 1]
set mncat [lindex $line 2]
set catarg [l..."
(file "./test1.sh" line 6)
Any ideas? I take this out
set test1 [exec grep -c tot $fname]
puts $test1
set test1 0
and it works fine.
Free Firewall/Network/Systems Support-