I am in the process of writing bioinformatics pipelines. These pipelines take in input files and pass them through multiple packages.

Say there is a list of files that goes file1, file2, file3... file n, and for each I want to apply a function that goes function1 -file 1| function 2 | function 3 > file 1.output but want to do it for the whole list of files using a for loop, and allocate file names to the output files accordingly, what commands and syntax should I use?

1 Answer 1


According to the information in your question, this should do what you requested:

for i in file1 file2 file3 file4 fileN
     function1 "$i"| function2 | function3 > "$i".output

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.