Hello Guys;
The situation I am having is;
I wrote a script to run a file using a program installed on the system. Now, the whole thing works properly, except I have multiple files that I need the program to run on.
To do his I kept the whole thing in a loop, in which the variable of the loop corresponds to the name of the file.
So by thought, I expected perl to run the loop, open the file using that program and when it's done, it simply goes to the end of the loop and back to the begining and increments, then do it again. Eg.
for ($x=2; $x >= 0;$x--)
{
for ($y=2; $y >= 0;$y--)
{
system("prog name -f file_$x_$y.ext >tracker_$x$y.log");
}
}
but instead (and rather unexpected), it stops after the first loop, and then when I check its status, I notice the program has just stopped. It's finished what it has to do but it remains within that program, and perl just stays still (I'm guessing waiting for the program to exit).
Now, to solve this I always have to physically press cntrl - C
in the bash (terminal), and this ends the program (not the script, but the program initiated by the script), and then the loop resumes, only to happen again.
That's why I was hoping I could make perl issue the 'cntrl-c; command and then the loop continues making the whole thing autonomous.
Now, if I make use of the kill, realised it would kill everything
(when I just want to kil the running program (not the script). I hope I was explanatory enough.
Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
Read Where should I post X? if you're not absolutely sure you're posting in the right place.
Please read these before you post! —
Posts may use any of the Perl Monks Approved HTML tags:
- a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
| |
For: |
|
Use: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.