I'm glad we could help.
You might continue refining this script in the course, or the instructor might throw different types of input to test how robust your script is. So, I'd also like to give you a heads-up on a potential hiccup. This might be one of the things 14moose was getting at also.
It might be a good idea for you to read up on the special variable IFS (man bash
). Your use of double quotes around filenames with the cp command tells me that you're concerned the filenames might, for instance, have spaces in them. If that is the case, your for loop will not behave as you expect.
As an example, try the following:
$ mkdir testing
$ cd testing
$ touch my_test_file1.txt
$ touch "my test file2.txt"
$ for x in `ls -1`; do echo $x; done