Hello Guys,
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.
THanks in advance.
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.
THanks in advance.