I have a command that takes a file name as a variable, I have given it as a name pattern, file_*_123.txt
Script.sh file_*_123.txt
Now if there are more than one files with matching pattern it only executes for the first file, I want this script to be executed for each file matching the name pattern. for e.g.
file_1_123.txt, file_2_123.txt, file_3_123.txt
Someone kind of for loop. However, because the number of file(s) can be 1 or more than 1 so not sure how to iterate through.
Can anyone please suggest a solution to it.
find
, specifically the-exec
option.