Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:
#!/usr/local/bin/perl -w for(;;) #repeat forever { print "please enter a command\n"; $cmd = <STDIN>; #get input from keyboard chomp ($cmd); #remove carriage return if ($cmd =~/^q$/i) #if cmd is quit { exit; #exit from program } else { if (fork== 0) #child process created { exec $cmd; #execute the command } wait; #wait for child process to terminate } }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: simple perl2
by Beatnik (Parson) on Jun 18, 2001 at 21:02 UTC | |
|
Re: simple perl2
by virtualsue (Vicar) on Jun 18, 2001 at 23:49 UTC | |
|
Re: simple perl2
by DrZaius (Monk) on Jun 18, 2001 at 22:11 UTC |