Solved

while read logic in script file

Posted on 2004-09-03
2
333 Views
Last Modified: 2013-12-27
I'm trying to create a script file that will checkin files to ClearCase, and I'm stuck on the "while read" logic.

Here's the part I'm stuck on:

find $2/* -type d > ~/dir_list

while read ~/dir_list
  do
    dir=`echo $dir_list`
    cleartool mkdir -nc $dir
    cleartool protect -chmod 775 $dir
  done < ~/dir_list

Originally the above script was setup to put the dir_list file in the ClearCase checkout directory,
And it did work that way, but I'm trying to set it up so that it puts the file in the user's home directory.
~/dir_list

To see the entire script, check out the following link:

http://axter.com/script/cm_add_elem.txt
What am I doing wrong with the variable names in the while loop?
0
Comment
Question by:Axter
2 Comments
 
LVL 20

Accepted Solution

by:
tfewster earned 500 total points
ID: 11976420
find $2/* -type d > ~/dir_list

while read DIR
  do
    echo $DIR
    cleartool mkdir -nc $DIR
    cleartool protect -chmod 775 $DIR
  done < ~/dir_list
0
 
LVL 30

Author Comment

by:Axter
ID: 11976604
Thanks, that works. :-)
0

Featured Post

Gigs: Get Your Project Delivered by an Expert

Select from freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely and get projects done right.

Question has a verified solution.

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

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…
FreeBSD on EC2 FreeBSD (https://www.freebsd.org) is a robust Unix-like operating system that has been around for many years. FreeBSD is available on Amazon EC2 through Amazon Machine Images (AMIs) provided by FreeBSD developer and security office…
Learn several ways to interact with files and get file information from the bash shell. ls lists the contents of a directory: Using the -a flag displays hidden files: Using the -l flag formats the output in a long list: The file command gives us mor…
Learn how to find files with the shell using the find and locate commands. Use locate to find a needle in a haystack.: With locate, check if the file still exists.: Use find to get the actual location of the file.:

813 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

Need Help in Real-Time?

Connect with top rated Experts

16 Experts available now in Live!

Get 1:1 Help Now