Link to home
Start Free TrialLog in
Avatar of wademi
wademi

asked on

How to save and execute a C shell scrip?

I have a simple Cshell script as follows:

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

foreach directory (`ls`)

test -d "$SourceDir/$directory" && echo "$SourceDir/$directory"

end

How do I save and execute the above script to a file in ubuntu and execute it via a terminal session?

where should I store the script?

ASKER CERTIFIED SOLUTION
Avatar of farzanj
farzanj
Flag of Canada 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
To redirect the output to a file you would use
./script.csh > filename_where_results_will_be_stored