Link to home
Start Free TrialLog in
Avatar of wademi
wademi

asked on

In C shell How do I get the folder name using a foreach loop

In C shell How do I get the folder name using a foreach loop
Avatar of arnold
arnold
Flag of United States of America image

foreach directory (`ls`)
test -d "$directory" && echo "This is a directory: $directory"
end
Avatar of wademi
wademi

ASKER

This is what I had before:

#! /bin/csh -f
set SourceDir = /home/milligram/mnt
set DestDir_IOS = Myvideos/IOS


foreach directory ($SourceDir)

echo $SourceDir

end


can you corect it for me. Thanks a million!!!!!!!!!
Avatar of wademi

ASKER

Can you explain

what is the 'ls' for?
 what does the "test" do? is it a cshell syntax?
Can variables be placed in quotes.."$directory"


foreach directory (`ls`)
test -d "$directory" && echo "This is a directory: $directory"
end
ASKER CERTIFIED SOLUTION
Avatar of arnold
arnold
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial