#!/usr/bin/perl
use warnings;
#WINDOW 1
system ("dialog --keep-window --menu Customize 10 70 50 'Flush rules' 'Clear all the rules' 2> /tmp/customize.txt ");
open FILE4, "/tmp/customize.txt" or die $!;
chomp(my $customize = <FILE4>);
if($customize =~ /Flush rules/){
`iptables -F`;
system ("dialog --infobox 'All tables have been flushed.' 05 35");
}
else{
exit;
}
When the above code is executed then a dialog box appears which shows an option to flush rules. When I press Enter the command iptables -F executes and it flushes all the iptables rules. After that the program terminates. I want that after flushing all the rules the window which came in starting i.e which gives the option to flush rules should not close. The program should not terminate after flushing the rules. It should come back to the window1.
How about surrounding it with:
You could add an exit option to the dialog box and have break the while loop when that option is chosen.