Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Perl > Perl Misc > Executing commands.

Reply
Thread Tools

Executing commands.

 
 
Connell Gauld
Guest
Posts: n/a
 
      03-05-2004
Hey,
I'm trying to right a perl script on Linux which will run a certain
executable.
Is there a Perl command which will do this eg:
command "/bin/something parameters";

Thanks for any help.
Connell Gauld


 
Reply With Quote
 
 
 
 
Paul Lalli
Guest
Posts: n/a
 
      03-05-2004
On Fri, 5 Mar 2004, Connell Gauld wrote:

> Hey,
> I'm trying to right a perl script on Linux which will run a certain
> executable.
> Is there a Perl command which will do this eg:
> command "/bin/something parameters";
>
> Thanks for any help.
> Connell Gauld


There are several.

$s = system ("/bin/something parameters"); will call whatever shell you're
using, and return the exit code of 'something'.

$s = system ("/bin/something", "parameter1", "paremeter2"); will call
'something' directly, bypassing the shell, and feeding it the paremeters.
Again returns the exit code.

$s = `/bin/something parameters`; returns the output of the command.

@s = `/bin/something parameters`; returns the output of the command as an
array, with each element containing one line of output.


Then there are pipes, which are mildly more complicated. If you just want
to run an external program, chances are you don't need them.

Paul Lalli
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Executing Shell speedster Perl 1 03-17-2005 09:22 PM
Window Disappearing after executing Perl Script Mitchley Perl 2 06-15-2004 07:49 PM
Remotely executing commands over Serial Port Mitchley Perl 0 06-09-2004 11:48 PM
Executing a multiple line statement MrTrix Perl 8 10-06-2003 09:40 PM
Session end event fires but it is not executing code Sampriti ASP .Net 4 06-26-2003 10:54 PM



Advertisments