Relative Content

Tag Archive for bashloops

How can I write a loop to execute a command for each file as specified by user input?

Below is part of a script to execute a command on a file defined by the variable DSpath. There are several of these files distinguished by the number at the end of the filename “_01”. The variable numlongs define how many of these files are present. What is the best way to write a loop which will execute the command for each of these files using the variables? Thank you.

How can I write a loop to execute a command for each file as specified by user input?

Below is part of a script to execute a command on a file defined by the variable DSpath. There are several of these files distinguished by the number at the end of the filename “_01”. The variable numlongs define how many of these files are present. What is the best way to write a loop which will execute the command for each of these files using the variables? Thank you.