The UNIX and Linux Forums  

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




View Single Post in the UNIX and Linux Forums - Click on the Thread or Permalink to View Entire Thread -->
  #3 (permalink)  
Old 07-03-2009
ejdv ejdv is offline
Registered User
  
 

Join Date: Nov 2007
Posts: 46
Quote:
Originally Posted by KevinADC View Post
open the tmp directory and search it?
@KevinADC,

Okay, a bit short (open it ? search it ? search what ?) , but I think I got it.


Code:
@dir2_contents = </tmp/dir1/dir2/*>;

foreach $item (@dir2_contents) {
  if ( -d $item ) {
    $needed_dir = basename($item);
  }
}

printf "needed_dir = $needed_dir\n";