For Programmers: Free Programming Magazines  


Home > Archive > PERL Beginners > July 2006 > command execution









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author command execution
Irfan Sayed

2006-07-25, 3:57 am

Hi All,

I am executing following command

` $MT chreplica`;

I need to find out wheather this command is executing properly or not.

If it's executing properly then i need to print the message saying that
" command executed successfully"

Can anybody please help me.

Regards
Irfan.



Prabu

2006-07-25, 3:57 am

Sayed, Irfan (Irfan) wrote:
> Hi All,
>
> I am executing following command
>
> ` $MT chreplica`;
>
> I need to find out wheather this command is executing properly or not.
>
> If it's executing properly then i need to print the message saying that
> " command executed successfully"
>
> Can anybody please help me.
>
> Regards
> Irfan.
>

The exit status of the command will be in $?

So check this one to get the result.

On success return 0 and for the failure some non-zero value

---
Prabu.M.A
David Romano

2006-07-25, 6:57 pm

Hi Irfan,
On 7/24/06, Sayed, Irfan (Irfan) <isayed@avaya.com> wrote:
> Hi All,
>
> I am executing following command
>
> ` $MT chreplica`;
>
> I need to find out wheather this command is executing properly or not.

From what I remember `` gives the output of the command pass in, and
since it looks like you're not assigning the output to a variable, you
might use the system() function to get its exit status. Check out the
perldoc for it, either by typing at the terminal:
perldoc -f system

or going to http://perldoc.perl.org/functions/system.html

HTH,
David
Sponsored Links







Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive

Copyright 2008 codecomments.com