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 -->
  #3 (permalink)  
Old 08-11-2007
lorcan lorcan is offline
Registered User
  
 

Join Date: May 2007
Posts: 219
A small correction blowtorch.

Code:
for file in *; do
   if [ -d $file ]; then
      mkdir $file/test; 
   fi
done
Since you had issued a cd command it would create the sub-dir only for the first directory. So the result would not be as expected.

Last edited by lorcan; 08-11-2007 at 08:51 AM..