Hi,
I am writing a Perl script and I need to execute Unix Ctrl-Z on the script. How can I do it in Perl ?
thanks.
Hi,
I am writing a Perl script and I need to execute Unix Ctrl-Z on the script. How can I do it in Perl ?
thanks.
In bash ctrl-z stops the current job and puts it in background with %JobId you can return to this job. I'm not sure what you mean since I thought ctrl-z is caught by bash..
From perl you can send signals to processes with the function kill, which has the same name as the Unix command line tool that does the same thing. The equivalent to Ctrl-Z is running
kill -SIGTSTP pid
you need to find out what numeric value your TSTP signal has on your system. You would do this by running
kill -l TSTP
on the command line. Let's say this returns 20
Then in your Perl script you would add
kill 20 => $$;
which will send the TSTP signal to the currently running process id ($$)
Update: as described by daxim, you can skip the 'kill -l' part and provide the name of the signal directly:
kill 'TSTP' => $$;