perl and unix command
am 20.09.2007 15:11:58 von lerameur
Hello,
I am writting a perl scipt in unix and I will invoking some unix
commands in my script. If the first command takes a few minutes to
process, how do I make sure the second command do not start until the
first command is finished ?
thanks
ken
Re: perl and unix command
am 20.09.2007 15:19:29 von Tony Curtis
lerameur wrote:
> Hello,
>
> I am writting a perl scipt in unix and I will invoking some unix
> commands in my script. If the first command takes a few minutes to
> process, how do I make sure the second command do not start until the
> first command is finished ?
perldoc -f system
Re: perl and unix command
am 20.09.2007 15:39:39 von lerameur
> > Hello,
>
> > I am writting a perl scipt in unix and I will invoking some unix
> > commands in my script. If the first command takes a few minutes to
> > process, how do I make sure the second command do not start until the
> > first command is finished ?
>
> perldoc -f system
...
/>perldoc -f system
ksh: perldoc: not found
Re: perl and unix command
am 20.09.2007 15:42:37 von Glenn Jackman
At 2007-09-20 09:39AM, "lerameur" wrote:
>
> > > Hello,
> >
> > > I am writting a perl scipt in unix and I will invoking some unix
> > > commands in my script. If the first command takes a few minutes to
> > > process, how do I make sure the second command do not start until the
> > > first command is finished ?
> >
> > perldoc -f system
>
> ..
>
> />perldoc -f system
> ksh: perldoc: not found
As you're using google already, you might want to use its search
function. I hear its pretty good...
--
Glenn Jackman
"You can only be young once. But you can always be immature." -- Dave Barry
Re: perl and unix command
am 20.09.2007 15:57:34 von lerameur
On Sep 20, 9:42 am, Glenn Jackman wrote:
> At 2007-09-20 09:39AM, "lerameur" wrote:
>
>
>
> > > > Hello,
>
> > > > I am writting a perl scipt in unix and I will invoking some unix
> > > > commands in my script. If the first command takes a few minutes to
> > > > process, how do I make sure the second command do not start until the
> > > > first command is finished ?
>
> > > perldoc -f system
>
> > ..
>
> > />perldoc -f system
> > ksh: perldoc: not found
>
> As you're using google already, you might want to use its search
> function. I hear its pretty good...
google?
1,680,000 results, most of them refering to unix command in perl, in
the one I looked, have not seen any with execution time analysis
between commands.
maybe you have googled one
k
Re: perl and unix command
am 20.09.2007 16:08:36 von Tony Curtis
lerameur wrote:
> google?
> 1,680,000 results, most of them refering to unix command in perl, in
> the one I looked, have not seen any with execution time analysis
> between commands.
> maybe you have googled one
You didn't ask about "execution time analysis".
Show us an example of what you're trying to do.
Re: perl and unix command
am 20.09.2007 16:28:41 von lerameur
On Sep 20, 10:08 am, Tony Curtis wrote:
> lerameur wrote:
> > google?
> > 1,680,000 results, most of them refering to unix command in perl, in
> > the one I looked, have not seen any with execution time analysis
> > between commands.
> > maybe you have googled one
>
> You didn't ask about "execution time analysis".
>
> Show us an example of what you're trying to do.
I though I did in the first message.
Example:
> scan_log.pl
> rm *.log
here are the two unix command I want to put in a perl script, The scan
log script can take 2 minutes to do the scan. I want to make sure the
rm *.log command to starts after the scan_log. I am scared that once
the scan_log.pl has been read, the script will go to the next line and
run the rm *.log command before the scan_log.pl has finished scanning.
ken
Re: perl and unix command
am 20.09.2007 16:34:35 von chris-usenet
lerameur wrote:
> />perldoc -f system
> ksh: perldoc: not found
Ask your System Administrator to install perl properly.
Re: perl and unix command
am 20.09.2007 16:42:30 von Paul Lalli
On Sep 20, 9:39 am, lerameur wrote:
> > > I am writting a perl scipt in unix and I will invoking some
> > > unix commands in my script. If the first command takes a few
> > > minutes to process, how do I make sure the second command do
> > > not start until the first command is finished ?
>
> > perldoc -f system
>
> ..
>
> />perldoc -f system
> ksh: perldoc: not found
Your installation of Perl is broken. Have your local sysadmins fix
it.
In the meantime, perldoc on the web: http://perldoc.perl.org/functions/system.html
Paul Lalli
Re: perl and unix command
am 20.09.2007 17:21:06 von Josef Moellers
lerameur wrote:
> On Sep 20, 10:08 am, Tony Curtis wrote:
>=20
>>lerameur wrote:
>>
>>>google?
>>>1,680,000 results, most of them refering to unix command in perl, in
>>>the one I looked, have not seen any with execution time analysis
>>>between commands.
>>>maybe you have googled one
>>
>>You didn't ask about "execution time analysis".
>>
>>Show us an example of what you're trying to do.
>=20
>=20
> I though I did in the first message.
> Example:
>=20
>>scan_log.pl
>>rm *.log
>=20
>=20
> here are the two unix command I want to put in a perl script, The scan
> log script can take 2 minutes to do the scan. I want to make sure the
> rm *.log command to starts after the scan_log. I am scared that once
> the scan_log.pl has been read, the script will go to the next line and
> run the rm *.log command before the scan_log.pl has finished scanning.
The system() function will not return until the command within has=20
terminated. Beware that if you write something like
system("scan_log.pl&");
then "the command within" is a shell, which in turn starts scan_log.pl=20
without waiting for it and thus will terminate before scan_log.pl has=20
finished.
I.e.
system("scan_log.pl");
system("rm *.log");
will be what you want.
--=20
These are my personal views and not those of Fujitsu Siemens Computers!
Josef Möllers (Pinguinpfleger bei FSC)
If failure had no penalty success would not be a prize (T. Pratchett)
Company Details: http://www.fujitsu-siemens.com/imprint.html
Re: perl and unix command
am 20.09.2007 17:28:18 von lerameur
On Sep 20, 11:21 am, Josef Moellers
siemens.com> wrote:
> lerameur wrote:
> > On Sep 20, 10:08 am, Tony Curtis wrote:
>
> >>lerameur wrote:
>
> >>>google?
> >>>1,680,000 results, most of them refering to unix command in perl, in
> >>>the one I looked, have not seen any with execution time analysis
> >>>between commands.
> >>>maybe you have googled one
>
> >>You didn't ask about "execution time analysis".
>
> >>Show us an example of what you're trying to do.
>
> > I though I did in the first message.
> > Example:
>
> >>scan_log.pl
> >>rm *.log
>
> > here are the two unix command I want to put in a perl script, The scan
> > log script can take 2 minutes to do the scan. I want to make sure the
> > rm *.log command to starts after the scan_log. I am scared that once
> > the scan_log.pl has been read, the script will go to the next line and
> > run the rm *.log command before the scan_log.pl has finished scanning.
>
> The system() function will not return until the command within has
> terminated. Beware that if you write something like
> system("scan_log.pl&");
> then "the command within" is a shell, which in turn starts scan_log.pl
> without waiting for it and thus will terminate before scan_log.pl has
> finished.
>
> I.e.
> system("scan_log.pl");
> system("rm *.log");
> will be what you want.
> --
> These are my personal views and not those of Fujitsu Siemens Computers!
> Josef Möllers (Pinguinpfleger bei FSC)
> If failure had no penalty success would not be a prize (T. Pratc=
hett)
> Company Details:http://www.fujitsu-siemens.com/imprint.html
ok thank you
k
Re: perl and unix command
am 20.09.2007 18:29:35 von Ted Zlatanov
On Thu, 20 Sep 2007 06:11:58 -0700 lerameur wrote:
l> I am writting a perl scipt in unix and I will invoking some unix
l> commands in my script. If the first command takes a few minutes to
l> process, how do I make sure the second command do not start until the
l> first command is finished ?
This is what will happen by default, unless the first command takes
special measures to detach itself and run in the background.
In Unix terms, the Perl process running the command is waiting for the
child process to exit every time it calls system(). There's more to the
picture (there are different ways to call system() for instance), but
this is the essential idea.
Ted
Re: perl and unix command
am 20.09.2007 18:39:10 von xhoster
lerameur wrote:
> > > Hello,
> >
> > > I am writting a perl scipt in unix and I will invoking some unix
> > > commands in my script. If the first command takes a few minutes to
> > > process, how do I make sure the second command do not start until the
> > > first command is finished ?
> >
> > perldoc -f system
>
> ..
>
> />perldoc -f system
> ksh: perldoc: not found
Install Perl on your system.
Xho
--
-------------------- http://NewsReader.Com/ --------------------
The costs of publication of this article were defrayed in part by the
payment of page charges. This article must therefore be hereby marked
advertisement in accordance with 18 U.S.C. Section 1734 solely to indicate
this fact.
Re: perl and unix command
am 20.09.2007 19:09:14 von Sherm Pendley
lerameur writes:
>> > Hello,
>>
>> > I am writting a perl scipt in unix and I will invoking some unix
>> > commands in my script. If the first command takes a few minutes to
>> > process, how do I make sure the second command do not start until the
>> > first command is finished ?
>>
>> perldoc -f system
>
> ..
>
> />perldoc -f system
> ksh: perldoc: not found
Try "man system" - Perl docs are often installed as man pages also.
Also, check to see if your OS has a "perl-docs" or similar port|rpm|deb
or other package. Some vendors like to split Perl into multiple packages,
with separate developer and docs packages.
You really should fix this problem of missing docs before going any further
with anything else. Your question is a fairly simple one; I say that not to
insult you, but just to illustrate your experience level. At your level,
trying to learn Perl without having the docs on hand is like trying to paint
a wall with both hands tied. Both hands, and your feet too.
sherm--
--
Web Hosting by West Virginians, for West Virginians: http://wv-www.net
Cocoa programming in Perl: http://camelbones.sourceforge.net
Re: perl and unix command
am 20.09.2007 19:18:21 von Dummy
Sherm Pendley wrote:
> lerameur writes:
>
>>>> Hello,
>>>> I am writting a perl scipt in unix and I will invoking some unix
>>>> commands in my script. If the first command takes a few minutes to
>>>> process, how do I make sure the second command do not start until the
>>>> first command is finished ?
>>> perldoc -f system
>> ..
>>
>> />perldoc -f system
>> ksh: perldoc: not found
>
> Try "man system" - Perl docs are often installed as man pages also.
That will probably get you the system(3) man page instead of Perl's system
function (although they basicly do the same thing.)
"man perlfunc" will get you the listing for Perl's system function.
> Also, check to see if your OS has a "perl-docs" or similar port|rpm|deb
> or other package. Some vendors like to split Perl into multiple packages,
> with separate developer and docs packages.
Kubuntu does this. I had to manually install a lot of stuff.
John
--
Perl isn't a toolbox, but a small machine shop where you
can special-order certain sorts of tools at low cost and
in short order. -- Larry Wall
Re: perl and unix command
am 20.09.2007 20:53:15 von lerameur
>
> > Try "man system" - Perl docs are often installed as man pages also.
>
> That will probably get you the system(3) man page instead of Perl's system
> function (although they basicly do the same thing.)
>
> "man perlfunc" will get you the listing for Perl's system function.
>
> > Also, check to see if your OS has a "perl-docs" or similar port|rpm|deb
> > or other package. Some vendors like to split Perl into multiple packages,
> > with separate developer and docs packages.
>
> Kubuntu does this. I had to manually install a lot of stuff.
>
> John
> --
> Perl isn't a toolbox, but a small machine shop where you
> can special-order certain sorts of tools at low cost and
> in short order. -- Larry Wall
I am running on sunOS 5.9 (solaris)
I do not know unix that much, so I do not know if it is a perl issue
with that specific OS.
"man perlfunc" do not work by the way
k
Re: perl and unix command
am 20.09.2007 21:07:10 von Jim Cochrane
On 2007-09-20, lerameur wrote:
> On Sep 20, 9:42 am, Glenn Jackman wrote:
>> At 2007-09-20 09:39AM, "lerameur" wrote:
>>
>>
>>
>> > > > Hello,
>>
>> > > > I am writting a perl scipt in unix and I will invoking some unix
>> > > > commands in my script. If the first command takes a few minutes to
>> > > > process, how do I make sure the second command do not start until the
>> > > > first command is finished ?
>>
>> > > perldoc -f system
>>
>> > ..
>>
>> > />perldoc -f system
>> > ksh: perldoc: not found
>>
>> As you're using google already, you might want to use its search
>> function. I hear its pretty good...
>
>
> google?
> 1,680,000 results, most of them refering to unix command in perl, in
> the one I looked, have not seen any with execution time analysis
> between commands.
> maybe you have googled one
http://www.google.com/search?num=20&hl=en&safe=off&client=fi refox-a&rls=org.mozilla%3Aen-US%3Aofficial&hs=RW6&q=perldoc+ system&btnG=Search
yields (2nd listing):
http://www.ayni.com/perldoc/perl5.8.0/pod/func/system.html
--
Re: perl and unix command
am 20.09.2007 22:45:19 von chris-usenet
lerameur wrote [regarding missing "perldoc"]:
> I am running on sunOS 5.9 (solaris)
> I do not know unix that much, so I do not know if it is a perl issue
> with that specific OS.
It's a Solaris issue. Perl is installed into /usr/perl5/5.6.1 but only
perl itself is symlinked back into /usr/bin.
Two solutions, either of which will work:
(a) Add this statement to your ".profile" either near the top, or
immediately after the last line starting "PATH=" (if there is one):
PATH="/usr/perl5/5.6.1/bin:$PATH" export PATH
To make the change effective immediately, also type it directly at
the command prompt (just this once)
(b) Ask your System Administrator to complete Sun's botched installation
of perl, by adding its commands to /usr/bin, with a command such as
this:
cd /usr/bin && ln -s ../perl5/5.6.1/* .
This command will complain that perl already exists - don't worry
about that. Don't forget the trailing dot!!
Hope this helps,
Chris
Re: perl and unix command
am 21.09.2007 03:32:08 von Tad McClellan
Paul Lalli wrote:
> On Sep 20, 9:39 am, lerameur wrote:
>
>> > > I am writting a perl scipt in unix and I will invoking some
>> > > unix commands in my script. If the first command takes a few
>> > > minutes to process, how do I make sure the second command do
>> > > not start until the first command is finished ?
>>
>> > perldoc -f system
>>
>> ..
>>
>> />perldoc -f system
>> ksh: perldoc: not found
>
> Your installation of Perl is broken.
Or you don't have the right directories in your PATH.
--
Tad McClellan
email: perl -le "print scalar reverse qq/moc.noitatibaher\100cmdat/"
Re: perl and unix command
am 21.09.2007 21:30:08 von lerameur
the command:
PATH="/usr/perl5/5.6.1/bin:$PATH" export PATH
works great. I have access to my perldoc pages.
thanks
ken