Hi,
I am trying to incorporate multiple while loops into an expect script written in ksh shell. This is on a Solaris 10 system. Here is the code:
#!/bin/ksh
EXPECT=/usr/local/bin/expect
exp_internal
i=1
h=0
while [[ $i -le 9 && $h -le 23 ]]; do
$EXPECT << DONE
set stty_init raw
spawn database_connect
expect ">"
send "insert into DB1 \(account, sum, DATETIME_
ID\) values (\'BG0$i\', 100, \'2012-02-01 0$h:30:00\'\)\r"
expect eof
close $fp
DONE
((i+=1))
((h+=1))
done
So far the script loops with the 9 values for variable $i as desired.
However, not all values in range are looped for $h.
The while for $i runs to completion and increments $h with each iteration
Here is output of script so far:
./db.ksh[3]: exp_internal: not found
spawn database_connect
(db)> insert into DB1 (account, sum, DATETIME_ID) values ('BG01', 100, '2012-02-01 00:30:00')^M1 row(s) inserted
Execution time: 2.852 seconds
(db)> spawn database_connect
(db)> insert into DB1 (account, sum, DATETIME_ID) values ('BG02', 100, '2012-02-01 01:30:00')
:
:
I would like all instances of variable $h to be applied to $i while first loop runs:
BG01 - 00:30
BG01 - 01:30
BG01 - 23:30
:
:
BG09 - 23:30
Any ideas on where I can improve my while loops to accomplish?