Have you tried:

        while read dir_name
        do
                echo $dir_name
        done < <( ls /boot/* )

-----Original Message-----
From: [email protected]
[mailto:[email protected]] On Behalf Of Jason
But
Sent: Tuesday, September 06, 2011 2:50 AM
To: [email protected]
Subject: Looping through files

Hello all

I am trying to make a sort-of complicated grub.cfg file where I want to
search a series of files on the disk.

At first I tried something like

for dir_name in /boot/* ; do
 echo $dir_name
 read
done

But this just printed "/boot/*"

Then I trid

for dir_name in `ls /boot` ; do
 echo $dir_name
 read
done

But this printed "`ls" and then "/boot`"

Obviously what I want to achieve is more than printing information but for
now I want to get the looping code right.

My question is: Is there any way to assign a list of files/directories to a
variable dynamically and/or use it in a loop like this?

Thanks

Jason

_______________________________________________
Help-grub mailing list
[email protected]
https://lists.gnu.org/mailman/listinfo/help-grub


_______________________________________________
Help-grub mailing list
[email protected]
https://lists.gnu.org/mailman/listinfo/help-grub

Reply via email to