I have a directory, that contains hundreds of subdirectories. The structure looks like this:
directory ---> subdirectory_1 ---> file1
| |---> file2
---> subdirectory_2 ---> file1
|---> file2
|
|
---> subdirectory_n --> more_files
Now I want to execute a shell command that executes on subdirectories in a continuous manner. Like first on sd1, sd2, sd3 and gives an output. Then on sd2, sd3, sd4 and vice versa.
Now I can do the following to execute a command on all the subdirectories:
'find some_string -maxdepth 1 -type d \( ! -name . \) -exec bash -c "cd \'{}\' && do something" \;'
But I can't seem to find a way to execute them in a continuous manner with a constant interval. Any suggestions?
`for d in ["sd1"-"sd2"] do ( cd "$d" && do stuff )
done`
– DarkMatter Aug 23 '17 at 07:42