Date: Wed, 23 Mar 2011 15:35:21 -0500 From: Ryan Coleman <editor@d3photography.com> To: Polytropon <freebsd@edvax.de> Cc: FreeBSD Mailing List <freebsd-questions@freebsd.org> Subject: Re: Automating mounting of ISO images Message-ID: <2A377C8B-D9E6-4E60-834C-5BD7C03AA552@d3photography.com> In-Reply-To: <20110323211605.4c893e70.freebsd@edvax.de> References: <21012F71-5038-45F1-98C6-72A0B1239009@d3photography.com> <31D3BED1-7035-435F-B127-EFAAF6AFF076@mac.com> <20D9B390-3190-4865-A19E-BDEDC595E7A2@d3photography.com> <20110323211605.4c893e70.freebsd@edvax.de>
index | next in thread | previous in thread | raw e-mail
Here's the working script (Yay!)
#! /bin/sh
for FILE in /mount/disc_images/*.iso; do
DEST=$FILE
DIRNAME=`basename ${FILE} .iso`
echo ${DIRNAME} ${FILE}
mkdir /mount/new_brighton/images/${DIRNAME}
mount -t cd9660 /dev/`mdconfig -f ${FILE}` /mount/new_brighton/images/${DIRNAME}
done
Thanks to Polytropon and Chuck for their guidance.
On Mar 23, 2011, at 3:16 PM, Polytropon wrote:
> On Wed, 23 Mar 2011 15:06:14 -0500, Ryan Coleman <editor@d3photography.com> 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:
>
> DIRNAME=${FILE%.iso}
>
> Adding this to the iteration list, you can easily create
> the directories needed prior to the mount attempt.
>
>
>
> --
> Polytropon
> Magdeburg, Germany
> Happy FreeBSD user since 4.0
> Andra moi ennepe, Mousa, ...
> _______________________________________________
> freebsd-questions@freebsd.org mailing list
> http://lists.freebsd.org/mailman/listinfo/freebsd-questions
> To unsubscribe, send any mail to "freebsd-questions-unsubscribe@freebsd.org"
help
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?2A377C8B-D9E6-4E60-834C-5BD7C03AA552>
