How To Specify Multiple Files with a Wildcard for an Rflist Script

How To Specify Multiple Files with a Wildcard for an Rflist Shell Script

In the previous examples, you have run the executables with a shell script, in which input and output files are specified inside the .sh file. If you want to run on a whole lot of files, it can get tedious to type every file name into the shell script. There are various solutions to this. Here is one solution: this is an example Perl script that allows you to run the example1 executable on a list of files specified with a wildcard. It can be modified to suit various situations.

Files for this example

Copy the following file from

/var/phy/project/hep/neutrino/work/schol/superk/examples
into your working directory:

The script

Running the script

First, try it in test mode:
./rfscript_example.pl 1 /var/phy/project/hep/neutrino/work/schol/superk/data/rfm*
It will create a shell script, rfscript.sh, with all the files satisfying the wildcard given as input files. Examine the shell script to check this.

You can then run ./rfscript.sh by hand. Or, you can create the shell script and run it, all in one step, by turning off test mode with:

./rfscript_example.pl 0 /var/phy/project/hep/neutrino/work/schol/superk/data/rfm*

Modifying the script

In addition to using your specific executable and shell script names, you can modify this Perl script to have it set environment variables in the shell script, allow more sophisticated selection of files, etc. You can specify additional arguments if necessary, too.