Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people, just like you, are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
Solved

Perl Script Help

Posted on 2013-11-19
1
278 Views
Last Modified: 2013-11-19
I need some help in writing a perl script, I know how to write scripts in Korn shell, So I need some help in transforming the korn shell logic to perl..

Step 1 : First I define a Runlist
Runlist : prescript.pl \
               configured.pl \
               postscript.pl\

Step 2: Then using For/While loop equivalent the scripts  in runlist should be executed one after other, The scripts are only run as root and only if they are successful the second one should be triggered

So can someone help me write this in Perl.

Thanks.
0
Comment
Question by:aanya247
1 Comment
 
LVL 31

Accepted Solution

by:
farzanj earned 500 total points
ID: 39660473
Something like:

#!/usr/bin/perl

my @list = ('prescript.pl',  'configured.pl',  'postscript.pl');

foreach $f (@list)
{
    if ( system("./$f 2> /dev/null" ) != 0 )
    {
        die "File $f failed\n";
    }
}

Open in new window

0

Featured Post

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Introduction We as admins face situation where we need to redirect websites to another. This may be required as a part of an upgrade keeping the old URL but website should be served from new URL. This document would brief you on different ways ca…
I have been pestered over the years to produce and distribute regular data extracts, and often the request have explicitly requested the data be emailed as an Excel attachement; specifically Excel, as it appears: CSV files confuse (no Red or Green h…
Learn how to navigate the file tree with the shell. Use pwd to print the current working directory: Use ls to list a directory's contents: Use cd to change to a new directory: Use wildcards instead of typing out long directory names: Use ../ to move…
Get a first impression of how PRTG looks and learn how it works.   This video is a short introduction to PRTG, as an initial overview or as a quick start for new PRTG users.

856 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question