Automating mounting of ISO images

Polytropon freebsd at
Wed Mar 23 20:16:07 UTC 2011

On Wed, 23 Mar 2011 15:06:14 -0500, Ryan Coleman <editor at> wrote:
> I am also trying to make the directories right before the attempt
> to mount the image (a 'duh' moment just now). 
> So I'd like to have just the filename, not the full path, made
> as a folder... 

A directory. :-)

> In other news: The ISOs are all made by me, so no special chars,
> just capital and lowercase letters, sometimes numbers, no spaces
> and use of underscores and hyphens.

Underscores and hypens are traditionally not a problem. Spaces
can be and need extra attention. But as you're using PROPER
filenames, it should be easy to get the target directory name
from the ISO filename.

The unelegant way is to use basename:

	DIRNAME=`basename ${FILE} .iso`

Of course, there's a sh builtin for the same purpose:


Adding this to the iteration list, you can easily create
the directories needed prior to the mount attempt.

Magdeburg, Germany
Happy FreeBSD user since 4.0
Andra moi ennepe, Mousa, ...

More information about the freebsd-questions mailing list