A
Andrea Spitaleri
Hi
how do I grab the output from shell after system?
I have a program which print out some information on the shell before
give you the prompt, something like that:
bash>program
so far so good...
version 2.1
help file program -h
program>
I would like to grab these lines before I get the prompt "program>"
and check for the versione. I tought that the below script could work
but it doesn't (that's normal because I am reading the output after
the system call):
#!/usr/bin/perl
use warnings;
use strict;
system "rasmol > out ";
open (OUT,"out") or die " $! ";
while(<OUT>){
chomp;
if (/^Version/) {
my @version=split;
if ($version[1]eq "2.7.2.1"){
exit;
}
}
}
I think that I need something more dynamic...
cheers
and
how do I grab the output from shell after system?
I have a program which print out some information on the shell before
give you the prompt, something like that:
bash>program
so far so good...
version 2.1
help file program -h
program>
I would like to grab these lines before I get the prompt "program>"
and check for the versione. I tought that the below script could work
but it doesn't (that's normal because I am reading the output after
the system call):
#!/usr/bin/perl
use warnings;
use strict;
system "rasmol > out ";
open (OUT,"out") or die " $! ";
while(<OUT>){
chomp;
if (/^Version/) {
my @version=split;
if ($version[1]eq "2.7.2.1"){
exit;
}
}
}
I think that I need something more dynamic...
cheers
and