I have a directory called DS1
. I am trying to copy it 4 times so I also have DS2
, DS3
, DS4
and DS5
.
I am able to use the following command from the terminal and it works:
for i in {2..5}; do cp -r /home/test/DS1 "DS$i"; done
However, when I enter it into a script like this:
#!/bin/sh
for i in {2..5}; do cp -r /home/test/DS1 "DS$i"; done
It creates one directory named DS{2..5}
instead of the directories with increments between 2 and 5. Not understanding what I'm doing wrong.