◄ 
▲ 
► |
|
# Mount the new empty loopback filesystem
echo "Mounting loopback file './fs' in the './tempfs/' directory"
LOOP_NUMBER=-1
false
until [ $? = 0 ]; do
LOOP_NUMBER=$(($LOOP_NUMBER + 1))
mount fs tempfs -o loop=/dev/loop$LOOP_NUMBER
done
Now I mount the 4MB filesystem I created. I use "mount" with the typical "what, where" arguments (what is the "fs" file, and where is an empty directory "tempfs"). Unfortunately, I need to use a loop device... An unused loop device. For all I know you might be already using a loop device to do something. So I built a loop to keep incrementing through loop devices until it finds one that doesn't throw an error. Using "false" insures I go into the loop with an error, and I test for the error using "$?".