#!/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 } }
In reply to Runaway Forking Problem (was: simple perl2) by Anonymous Monk
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |