1. Registered User
Join Date
Feb 2006
Posts
31

while [ \${i} -eq \${#jobname[@]} ]
do
set -A cmd\${i}
cmd\${i}=(
[date_conditions]=\$(grep "date_conditions:" tt | cut -c 18-)
[days_of_week]=\$(grep "days_of_week:" tt | cut -c 14-)
[exclude_calendar]=\$(grep "exclude_calendar:" tt | cut -c 19-)
[start_times]=\$(grep "start_times:" tt | cut -c 14-)
[max_run_alarm]=\$(grep "max_run_alarm:" tt | cut -c 16-)
[alarm_if_fail]=\$(grep "alarm_if_fail:" tt | cut -c 16-)
)

i=\${i}+1
done

it is giving me syntax error for "cmd\${i}=("
how to get that array thatt grows as the number of elements in the jobname array?

2. Registered User
Join Date
Jun 2003
Location
West Palm Beach, FL
Posts
2,713

Try this:
Code:
```i=0
while [ \$i -lt \${#jobname[*]} ]
do
set -A cmd\${i} \
[date_conditions]=\$(grep "date_conditions:" \${jobname[\$i]} | cut -c 18-) \
[days_of_week]=\$(grep "days_of_week:" \${jobname[\$i]} | cut -c 14-) \
[exclude_calendar]=\$(grep "exclude_calendar:" \${jobname[\$i]}| cut -c 19-) \
[start_times]=\$(grep "start_times:" \${jobname[\$i]} | cut -c 14-) \
[max_run_alarm]=\$(grep "max_run_alarm:" \${jobname[\$i]} | cut -c 16-) \
[alarm_if_fail]=\$(grep "alarm_if_fail:" \${jobname[\$i]} | cut -c 16-)
(( i += 1 ))
done```

#### Posting Permissions

• You may not post new threads
• You may not post replies
• You may not post attachments
• You may not edit your posts
•