mommydearest has asked for the wisdom of the Perl Monks concerning the following question:
#!/usr/local/bin/perl -w -s
#This script will allow the user to run a group of cells using a group file through the script.
$groupDir = &promptUser("Enter the entire directory path to your group file.");
print "$groupDir\n";
sub promptUser {
my($prompt, $default) = @_;
my $defaultValue = $default ? "$default" : "";
print "$prompt $defaultValue: ";
chomp(my $input = <STDIN>);
return $input ? $input : $default;
}
open(FH, "<$groupDir") || die "Sorry, I could not find a group file by that name here. $!\n";
use Getopt::Std;
my %Options;
getopt ('a', \%Options);
#this is the flow I want run on all of the cells in the file.
`$CLD_RV/rv_char.tcl`,
#it has 3 switches. The first is mandatory the last 2 are optional.
%Options = (c => `cell $cell`,
s => `use_slopefile 1`,
d => `dcc 1`)
close(FH);
#This script will allow the user to run a group of cells using a group file through the script.
$groupDir = &promptUser("Enter the entire directory path to your group file.");
print "$groupDir\n";
sub promptUser {
my($prompt, $default) = @_;
my $defaultValue = $default ? "$default" : "";
print "$prompt $defaultValue: ";
chomp(my $input = <STDIN>);
return $input ? $input : $default;
}
open(FH, "<$groupDir") || die "Sorry, I could not find a group file by that name here. $!\n";
use Getopt::Std;
my %Options;
getopt ('a', \%Options);
#this is the flow I want run on all of the cells in the file.
`$CLD_RV/rv_char.tcl`,
#it has 3 switches. The first is mandatory the last 2 are optional.
%Options = (c => `cell $cell`,
s => `use_slopefile 1`,
d => `dcc 1`)
close(FH);
|
---|
Replies are listed 'Best First'. | |
---|---|
Re: How to use getopts to look in a file and submit each item in the file to a job with different switches.
by ww (Archbishop) on Mar 08, 2010 at 21:09 UTC | |
Re: How to use getopts to look in a file and submit each item in the file to a job with different switches.
by cdarke (Prior) on Mar 09, 2010 at 09:16 UTC | |
by cdarke (Prior) on Mar 10, 2010 at 08:46 UTC |
Back to
Seekers of Perl Wisdom