Beefy Boxes and Bandwidth Generously Provided by pair Networks
We don't bite newbies here... much

Answer: How to run a shell script from a Perl program?

by Plankton (Vicar)
on Apr 03, 2009 at 16:06 UTC ( #755305=categorized answer: print w/replies, xml ) Need Help??

Q&A > programs and processes > How to run a shell script from a Perl program? - Answer contributed by Plankton

I like to do this sometimes ...
my $shell_out = <<`SHELL`; for fs in `/sbin/fdisk -l | grep -v swap | grep Linux | cut -d ' ' -f1 +` do /sbin/e2label \$fs | grep recovery > /dev/null 2>&1 && echo "Y +ES" && exit 0 done echo "NO" exit 0 SHELL
... to capture the stdout of the shell commands in a scalar var.

Log In?

What's my password?
Create A New User
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others meditating upon the Monastery: (5)
As of 2016-10-27 11:18 GMT
Find Nodes?
    Voting Booth?
    How many different varieties (color, size, etc) of socks do you have in your sock drawer?

    Results (359 votes). Check out past polls.