Re: Return value = 0

2010-05-26 Thread Shlomi Fish
On Wednesday 26 May 2010 18:16:18 Brandon McCaig wrote: > On Wed, May 26, 2010 at 9:43 AM, Andros Zuna wrote: > > But how could I test if the command executes if the return value changes? > > ...is there a unix command or other way that generates random/different > > return values?? > > The follo

Re: Return value = 0

2010-05-26 Thread Brandon McCaig
On Wed, May 26, 2010 at 9:43 AM, Andros Zuna wrote: > But how could I test if the command executes if the return value changes? > ...is there a unix command or other way that generates random/different > return values?? > The following C program will return a pseudo-random value every time it's r

Re: Return value = 0

2010-05-26 Thread Brian
On May 26, 2010, at 9:43 AM, Andros Zuna wrote: > Ok, I see, so the code should look somehow like this: > > #! > /usr/bin/perl > > use > warnings; > use > strict; > > > $command = "ls > -l"; ^^ Strongly suggest you use full paths here. > > while (system($command) != 0) > { >my > $c++ >

Re: Return value = 0

2010-05-26 Thread Andros Zuna
Ok, I see, so the code should look somehow like this: #! /usr/bin/perl use warnings; use strict; $command = "ls -l"; while (system($command) != 0) { my $c++ } But how could I test if the command executes if the return value changes? ...is there a unix command or other way that generates

Re: Return value = 0

2010-05-26 Thread Brian
On May 26, 2010, at 9:03 AM, Andros Zuna wrote: > Hi, > I did some few changes: > > #! > /usr/bin/perl > > # use > warnings; > # use > strict; > > > $command = `ls > -l`; > Looks like you're using backticks. Backticks actually causes perl to execute the command inside them and return the o

Re: Return value = 0

2010-05-26 Thread Andros Zuna
Hi, I did some few changes: #! /usr/bin/perl # use warnings; # use strict; $command = `ls -l`; if (system($command) == 0) { } elsif(system($command) != 0) { print "Failed to execute: $?\n"; my $c++ } But I'm still not getting it right, this is my error output: root@/user$ ./script.

RE: Return value = 0

2010-05-26 Thread Bob McConnell
while (system($command) != 0) { } Bob McConnell -Original Message- From: Andros Zuna [mailto:andros.z...@gmail.com] Sent: Wednesday, May 26, 2010 8:57 AM To: Chaitanya Yanamadala Cc: beginners@perl.org Subject: Re: Return value = 0 Hi, Thank you for the tip Chaitanya

Re: Return value = 0

2010-05-26 Thread Shlomi Fish
On Wednesday 26 May 2010 15:49:37 Andros Zuna wrote: > Hi! > I am trying to write a perl code that will retry the same command over > and over again until the return value is 0. > This is what I got for now: > > #! /usr/bin/perl > use warnings; > use strict; > > $command = 'ls -l'; > > if (syste

Re: Return value = 0

2010-05-26 Thread Andros Zuna
Hi, Thank you for the tip Chaitanya, but I still don't thik my script is working correct!? 2010/5/26 Chaitanya Yanamadala > u should give it as > $command=`ls -la`; > > > use the key on the top of TAB button with shift.. > * > Chaitanya > > "A man can get discouraged many times but he is not a

Re: Return value = 0

2010-05-26 Thread Chaitanya Yanamadala
u should give it as $command=`ls -la`; use the key on the top of TAB button with shift.. * Chaitanya "A man can get discouraged many times but he is not a failure until he stops trying..." "The difference between 'involvement' and 'commitment' is like an eggs-and-ham breakfast: the chicken was

Return value = 0

2010-05-26 Thread Andros Zuna
Hi! I am trying to write a perl code that will retry the same command over and over again until the return value is 0. This is what I got for now: #! /usr/bin/perl use warnings; use strict; $command = 'ls -l'; if (system($command) == 0) { } elsif(system($command != 0)) { print "Failed to execu