I have the following Perl scripts (though this applies to Python and other scripting languages): script1.pl
, script2.pl
, script3.pl
The way these scripts where written, users execute them with input flags, and the output is a file saved.
perl script1.pl --i input1.tsv ## this outputs the file `outputs1` perl script2.pl --i outputs1 ## this outputs the file `outputs2` perl script3.pl --i outputs2 ## this outputs the file `final_output`
Now, I would like to create an executable bash script that allows users to simply work with input1
and get the output in return final_output
.
Here's how I would do this with only one perl script, execute.sh
:
#!/bin/sh source ~/.bash_profile FLAG1="--i=$1" perl script1.pl $FLAG1
which could be run on the command line execute.sh input1.tsv
For my example with three scripts, how would I pipe the intermediate outputs into the intermediate scripts to created one execute.sh
script, e.g. outputs1
into script2.pl
, then outputs2
into scripts3.pl
, etc.?
Isn't there a way for me to do this without rewriting the perl/python scripts?
while (readline) { ...
in Perl, and outputting to standard out likewise trivial.