?
Solved

How do I declare c shell variables with a list of directory paths and use them in foreach

Posted on 2011-10-29
2
Medium Priority
?
427 Views
Last Modified: 2012-05-12
How do I declare c shell variables with a list of directory paths ?

I tried the following but I dont think its correct.

set DestDir[1] = /home/milligram/MyVideos/In
set DestDir[2] = /home/milligram/MyVideos/Is
set DestDir[3] = /home/milligram/MyVideos/IT
set DestDir[4] = /home/milligram/MyVideos/Ho
set DestDir[5] = /home/milligram/MyVideos/FM)
#set DestDir = (/home/milligram/MyVideos/In /home/milligram/MyVideos/Is /home/milligram/MyVideos/Ho /home/milligram/MyVideos/FM /home/milligram/MyVideos/IT)


how do I execute foreach loops with the paths?

Is this corret?

foreach dest ($DestDir)

echo $dest

end
0
Comment
Question by:wademi
2 Comments
 
LVL 31

Accepted Solution

by:
farzanj earned 2000 total points
ID: 37051607
Yes, it is correct.

set DestDir = (/home/milligram/MyVideos/In /home/milligram/MyVideos/Is /home/milligram/MyVideos/Ho /home/milligram/MyVideos/FM /home/milligram/MyVideos/IT)


foreach dest ($DestDir)

echo $dest

end
0
 
LVL 40

Expert Comment

by:omarfarid
ID: 37052001
if you are interested in creating / setting arrays then look at links below

http://www-cs.canisius.edu/ONLINESTUFF/UNIX/shellprogramming.html#M
http://www.grymoire.com/Unix/Csh.html#uh-22
0

Featured Post

New feature and membership benefit!

New feature! Upgrade and increase expert visibility of your issues with Priority Questions.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Let's say you need to move the data of a file system from one partition to another. This generally involves dismounting the file system, backing it up to tapes, and restoring it to a new partition. You may also copy the file system from one place to…
Java performance on Solaris - Managing CPUs There are various resource controls in operating system which directly/indirectly influence the performance of application. one of the most important resource controls is "CPU".   In a multithreaded…
Learn how to get help with Linux/Unix bash shell commands. Use help to read help documents for built in bash shell commands.: Use man to interface with the online reference manuals for shell commands.: Use man to search man pages for unknown command…
In a previous video, we went over how to export a DynamoDB table into Amazon S3.  In this video, we show how to load the export from S3 into a DynamoDB table.
Suggested Courses
Course of the Month15 days, 10 hours left to enroll

850 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question