Simple script question

Hi,
I recently installed Windows10, which promptly ate my bootloader. I fixed it by using Kiwi to create a live disk, and reinstalling grub from there following these steps:


$mount /dev/sda6 /mnt  ##mount root fs
$mkdir /mnt/boot           ##dir for boot
$mount /dev/sda4 /mnt/boot  ##mount boot partition

…mounting the virtual file-system:


$for i in /dev /dev/pts /proc /sys /run; do mount -B $i /mnt$i; done

…and then:


$chroot /mnt
$grub2-install /dev/sda

Worked like a dream, but the question I have is this, my scripting skills currently leave a bit to be desired, and though I found a working solution,
the post I found it in (on Ubuntu forums actually), didn’t really comment that for loop (beyond “##Mount your virtual filesystems”) or more specifically, what the ‘-B’ switch in it is (–bind??), if anyone could shed a little light on it, I’d really appreciate it.

Obviously, since it’s fixed, it’s not super important, but I do like to know what’s going on with them, rather than just blindly typing in commands without knowing
what I just did.

Thanks in advance

Yes, “-B” is equivalent to “–bind”.

I found that out by reading the man page for mount.

Oops. Double post. Sorry.

My browser froze when I clicked “submit” the first time. I had to kill it and reload it. But I should have checked if it was already posted before I tried again.

Great!
Must’ve been an off day, usually something like, “-B+mount+linux” in a search engine turns up something, but I couldn’t seem to find the relevant ‘b’…
I guess that’ll teach me to read the man page a little more closely, I did actually skim through it rather quickly, but evidently I missed that. One of those pages I thought “I’ll read this fully* sometime but not today”*, since it was already fixed.

Being able to find a quick fix on the net is way better than back in the day, when you had to comb through a bunch of books for it and all, but there are a few caveats (‘don’t get impatient’ being one of them :shame:). I guess there’s still certain benefit to putting together your own solution from a book though (or by **RTFM **for that matter;)), so I won’t throw them all out just yet. I was just writing down the steps I took to fix it, for future reference, and I wanted to make sure I wasn’t putting the wrong thing in **my **comments.
So I thank you kindly!