Here is my updated code
sub ReadPolicies { # based on the below command it reads values in ar +ray my ($type) = @_; my @Policies = `/opt/OV/bin/opctemplate -l | grep -i $type | awk '{pri +nt \$2}'`; return (@Policies); } #MAIN My @FailoverPolicies = &ReadPolicies(DBSPI); For (my $i=0; $i < @FailoverPolicies; $i++) { my $cmd "/opt/OV/bin/opctemplate -e" . " " . "$FailoverPolicies[$i]"; my $output= `$cmd`; # here i expect this command read each value from +the array and take action, -e to enable }
and this works fine but the problem i face is that i see so many <defunct> process on system and i think it is because first command is not completed and second also start and so one and one point this hangs.
What can i do to ensure 2nd command executes only when first is completed in the loop.Thank You.
-KAKA-In reply to Re^3: execution of command inside for loop fails
by kaka_2
in thread execution of command inside for loop fails
by kaka_2
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |