I want to write a script that will run a certain commands on my subdirectories with names containging or rather end with some strings, say, *-nom1, *-nom2, *-nom3. i.e.
for dir in $(subs)
do
// do something in this dir
done
my question is, would this be the way to list my sub-directories, if not what's the best way to do it:
subs = find -maxdepth 2 -type d -name '*-nom1'
&& find -maxdepth 2 -type d -name '*-nom2'
&& find -maxdepth 2 -type d -name '*-nom3'
I can test it on my Ubuntu terminal and it seems to work.
my script will be running on Debian if that helps.