The UNIX and Linux Forums  
Hello and Welcome from United States to the UNIX and Linux Forums! Thank You for Visiting and Joining Our Global Community.

Go Back   The UNIX and Linux Forums > Top Forums > Shell Programming and Scripting
.
google unix.com




Thread: foreach folder
View Single Post in the UNIX and Linux Forums - Click on the Thread or Permalink to View Entire Thread -->
  #1 (permalink)  
Old 08-10-2007
eltinator eltinator is offline
Registered User
  
 

Join Date: Jul 2007
Posts: 63
foreach folder

Hi,

I'm having a small issue here and I can't get it to work. I'm programming a script for bash and I need to do something to all the folder in a directory. So I'm in the directory and I want to use the foreach statement but I dont know how to reference all the folders of that directory. To make things simplistic here's my code:

Code:
foreach instance (.)
cd instance
mkdir test
end
basically for each folder in that directory, I want to cd into it and create a folder called test. Any ideas?