I have a directory which contains several folders.
I’d like to make a bash script to create directories with the same name in a different location.
Note that I don’t want to copy the folder structure, neither copy or move the folders. I just want to create folders with the same name in a different location.
I’m stuck. Using this:
for d in "template/modules/*"
do
# mkdir $(basename "$d");
echo $d;
echo "$d";
echo $(basename "$d");
done
Output:
template/modules/introduction template/modules/kitchen template/modules/test
template/modules/*
add_module.sh template
Any ideas?
Cheers
You need to put the asterisk outside the quotes:
In the first
echo,$dis expanded, but when you quote it, it’s not.