system commands fail in Perl script

[email protected] (neelay thaker) Tue, 22 Nov 2005 10:58:21 -0800
Newsgroups perl.scripts
Message-ID <[email protected]>
------=_Part_19144_31862073.1132685901108
Content-Type: text/plain; charset=ISO-8859-1
Content-Transfer-Encoding: quoted-printable
Content-Disposition: inline

Hi,
I have a Perl function which executes a series of "install" commands from a
source CD to a destination folder on the hard drive-
my $cmd =3D "install -m 755 $srcdir/$file1 $installdir";
my $op =3D system($cmd);
$cmd =3D "install -m 755 $srcdir/$file2 $installdir";
$op =3D system($cmd);
$cmd =3D "tar -zxf $file1";
$op =3D system($cmd);
...when these statements are executed first, only $file1 gets installed to
the $installdir. The second time I execute these statements, $file2 gets
installed and the third time, untaring takes place. In short, all three
commands are not executed in sequence on the same execution; I have to
execute the program thrice to get the desired result. The size of $file1 is
big, so it must be taking sometime to copy from the CD to the HD; but
doesn't system command return to the execution of main program only when it
is done executing the child process?
Also, apart from the return values, are there any other differences between
the system command and the qx command?
All help is highly appreciated.
Thanks.

-Neelay.

------=_Part_19144_31862073.1132685901108
Content-Type: text/html; charset=ISO-8859-1
Content-Transfer-Encoding: quoted-printable
Content-Disposition: inline

Hi,<br>
I have a Perl function which executes a series of &quot;install&quot; comma=
nds from a source CD to a destination folder on the hard drive-<br>
my $cmd =3D &quot;install -m 755 $srcdir/$file1 $installdir&quot;;<br>
my $op =3D system($cmd);<br>
$cmd =3D &quot;install -m 755 $srcdir/$file2 $installdir&quot;;<br>
$op =3D system($cmd);<br>
$cmd =3D &quot;tar -zxf $file1&quot;;<br>
$op =3D system($cmd);<br>
...when these statements are executed first, only $file1 gets installed
to the $installdir. The second time I execute these statements, $file2
gets installed and the third time, untaring takes place. In short, all
three commands are not executed in sequence on the same execution; I
have to execute the program thrice to get the desired result. The size
of $file1 is big, so it must be taking sometime to copy from the CD to
the HD; but doesn't system command return to the execution of main
program only when it is done executing the child process?<br>
Also, apart from the return values, are there any other differences between=
 the system command and the qx command?<br>
All help is highly appreciated.<br>
Thanks.<br>
<br>
-Neelay.<br>
<br>
<br>

------=_Part_19144_31862073.1132685901108--