From owner-freebsd-questions@FreeBSD.ORG Wed Mar 23 20:35:36 2011 Return-Path: Delivered-To: freebsd-questions@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 7D31D106564A for ; Wed, 23 Mar 2011 20:35:36 +0000 (UTC) (envelope-from editor@d3photography.com) Received: from server.cwis.biz (70-89-202-5-invergrove-mn.hfc.comcastbusiness.net [70.89.202.5]) by mx1.freebsd.org (Postfix) with ESMTP id 51DE08FC0A for ; Wed, 23 Mar 2011 20:35:36 +0000 (UTC) Received: from server.cwis.biz (localhost [127.0.0.1]) by server.cwis.biz (Postfix) with ESMTP id CCB762639A0A; Wed, 23 Mar 2011 15:35:58 -0500 (CDT) X-Virus-Scanned: amavisd-new at cwis.biz Received: from server.cwis.biz ([127.0.0.1]) by server.cwis.biz (server.cwis.biz [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id YUR3CQzTI86E; Wed, 23 Mar 2011 15:35:46 -0500 (CDT) Received: from [192.168.46.76] (unknown [64.122.64.171]) by server.cwis.biz (Postfix) with ESMTPSA id E0A672639A07; Wed, 23 Mar 2011 15:35:45 -0500 (CDT) Mime-Version: 1.0 (Apple Message framework v1082) Content-Type: text/plain; charset=us-ascii From: Ryan Coleman In-Reply-To: <20110323211605.4c893e70.freebsd@edvax.de> Date: Wed, 23 Mar 2011 15:35:21 -0500 Content-Transfer-Encoding: quoted-printable Message-Id: <2A377C8B-D9E6-4E60-834C-5BD7C03AA552@d3photography.com> 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> To: Polytropon X-Mailer: Apple Mail (2.1082) Cc: FreeBSD Mailing List Subject: Re: Automating mounting of ISO images X-BeenThere: freebsd-questions@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: User questions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 23 Mar 2011 20:35:36 -0000 Here's the working script (Yay!) #! /bin/sh for FILE in /mount/disc_images/*.iso; do DEST=3D$FILE DIRNAME=3D`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 = wrote: >> I am also trying to make the directories right before the attempt >> to mount the image (a 'duh' moment just now).=20 >> So I'd like to have just the filename, not the full path, made >> as a folder...=20 >=20 > A directory. :-) >=20 >=20 >=20 >> 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. >=20 > 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. >=20 > The unelegant way is to use basename: >=20 > DIRNAME=3D`basename ${FILE} .iso` >=20 > Of course, there's a sh builtin for the same purpose: >=20 > DIRNAME=3D${FILE%.iso} >=20 > Adding this to the iteration list, you can easily create > the directories needed prior to the mount attempt. >=20 >=20 >=20 > --=20 > 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"