Hi Forum,
I am struggling with the for loop in shell script.
Let me explain what is needed in the script.
I have a file which will conatin some strings like
file1
place1
place2
place3
checkpoint
some other text
some more text
Now what my requirement is
the words
place1,place2 and place3 are directory names
from this file i have to store these directory names in some array
so first i have to split the file in such a way that i have only directory names that is done with the below line of code:
sed -n -e '/checkpoint/q' -e '1,/checkpoint/p' /tmp/file2
now my file contains only
place1
place2
place3
now my question is how to run a loop so that all these strings are stored in some variables and then inside the loop i can enter into each of these directiries and do a long listing.The long listing part i know,but my only problem is how to enter into each of the directory specified in file2 using a loop.
Hope i have cleary mentioned the problem,appreciate a positive response if my problem is not clear please do let me know.Thanks