I have a number of directories I want to enter and all start with the same string "example". Beyond, in the same location, there are also other directories that I do NOT want to enter. I was used to loop in this way:
for dir1 in */
before other directories with other names were present in the same location, but now I cannot anymore. I tried to vary the command using:
for dir1 in "example"*/
or for dir1 in example*/ cd "dir1"
but it does not enter the directory.
It says: line 8: cd: example*//: file or directory does not exist.
How can I do that?
for dir1 in example*/without the quotes?for x in c*/; do echo $x; doneand it gives me the directory names that begin with "c". Could you please clarify what your statement, "does not work" means?forthrough to and including thecdcommand that failed?