I would like to run some commands within a number of directories as the following code outlines:
for d in dir*;
do
touch $d/file.txt
done
But while the above code works for directories without spaces in their names, it does not if they do have spaces like: Directory 1 instead of Directory1, each word is treated as a different directory. Any way to overcome this? Thanks.