Running bash script
Hi everyone, How can I run a loop similar to this regardless of the order of the listed commands.
for file in
do
head -n 2 $filename | tail -n 1
done
I would appreciate any recommendation and thanks in advance.
• 1,538 views
•
link
1 answer
Copy this into myscript.sh and run bash myscript.sh. You will need to replace *.fastq with whatever satisfies your conditions.
#!/bin/bash
for file in *.fastq
do
head -n 2 $file | tail -n 1
done
• 0 views
•
link
Log in to answer this question.
What do you mean when you say regardless of the order of the commands?
I mean I need to run a similar script by using variables equivalent to tail, head and file name. But the user can insert them in any order and it will run the script correctly according to the user needs. I can provide the user key or guide to guide them how to use the script.
similar to this loop
but the user type it in any order.