#!/usr/bin/perl
$scriptName = '';
$logFileName = '';
$numberOfSteps = '';
$restart = 'Y';
@step = ();
$error = 0;
foreach $_ (@configFile) {
next if ($_ =~ /^\s*$/);
next if ($_ =~ /^\s*#/);
chop();
if ($_ =~ /^\s*ScriptName:\s+\S+\s*$/) {
($tag,$scriptName) = split();
} elsif ($_ =~ /^\s*LogFileName:\s+\S+\s*$/) {
($tag,$logFileName) = split();
} elsif ($_ =~ /^\s*NumberOfSteps:\s+[0-9]+\s*$/) {
($tag,$numberOfSteps) = split();
} elsif ($_ =~ /\s*Restart:\s+\S+\s*$/) {
($tag,$restart) = split();
} elsif ($_ =~ /^\s*Step\s+[0-9]:/) {
$stepNum = $_;
$stepNum =~ s/^\s*Step\s+([0-9]+):.*$/$1/;
$command = $_;
$command =~ s/^\s*Step [0-9]:+\s+//;
$step[$stepNum] = $command;
} else {
print STDERR "Error: unknown config file line:\n";
print STDERR " $_\n";
$error = 1;
}
}
for ($i=1;$i<=$numberOfSteps;$i++) {
print "$i: $step[$i]\n";
$ret = system($step[$i]);
if ($ret) {
print STDERR "\nError: last step failed.\n";
exit(1);
}
}
####
#!/bin/ksh
ScriptEngine.pl << !
ScriptName: testScript
LogFileName: boing
NumberOfSteps: 4
Restart: N
Step 2: ls -l
Step 1: $HOME/bin/gettime
Step 4: ps -elf | grep wam
Step 3: /tmp/thing
!
##
##
#!/bin/ksh
print "This is the output."
print "You need to enter a value: "
read ans
print "You entered the value of $ans."
exit 1