Operating System - HP-UX
1845868 Members
4203 Online
110250 Solutions
New Discussion

Re: simple script main loop case switch

 
SOLVED
Go to solution
Bill McNAMARA_1
Honored Contributor

simple script main loop case switch

Hi,

looking for a script framework that reads and validates supplied args.

example, makefile:

make clean,
make all,
make build jar man depot

can't have
make all build ..
etc..

Thanks,
Bill
It works for me (tm)
2 REPLIES 2
Tom Maloy
Respected Contributor

Re: simple script main loop case switch

One perl possibility:

perl -nle '
CHECK: {
/^make build$/ and do {last CHECK};
/^make clean$/ and do {last CHECK};
/^make build( jar| man| depot)*$/ and do {last CHECK};
print "Error on $_";
}' txt

Tom
Carpe diem!
Tom Maloy
Respected Contributor
Solution

Re: simple script main loop case switch

A little bit cleaner...

perl -nle '
next if /^make build$/;
next if /^make clean$/;
next if /^make build( jar| man| depot)*$/;
print "Error on $_";
' txt

with your args in the "txt" file. Still have to write all of the REs by hand...

Tom
Carpe diem!