Entering edit mode
2.9 years ago
heba.hussin1010
•
0
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.
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.