From owner-freebsd-questions@FreeBSD.ORG Wed Mar 23 19:11:37 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 3EE30106566C for ; Wed, 23 Mar 2011 19:11:37 +0000 (UTC) (envelope-from cswiger@mac.com) Received: from asmtpout018.mac.com (asmtpout018.mac.com [17.148.16.93]) by mx1.freebsd.org (Postfix) with ESMTP id 257328FC0A for ; Wed, 23 Mar 2011 19:11:36 +0000 (UTC) MIME-version: 1.0 Content-transfer-encoding: 7BIT Content-type: text/plain; CHARSET=US-ASCII Received: from cswiger1.apple.com ([17.209.4.71]) by asmtp018.mac.com (Oracle Communications Messaging Exchange Server 7u4-20.01 64bit (built Nov 21 2010)) with ESMTPSA id <0LII009OEYN6CK90@asmtp018.mac.com> for freebsd-questions@freebsd.org; Wed, 23 Mar 2011 12:11:31 -0700 (PDT) X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10432:5.2.15,1.0.148,0.0.0000 definitions=2011-03-23_08:2011-03-23, 2011-03-23, 1970-01-01 signatures=0 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 spamscore=0 ipscore=0 suspectscore=0 phishscore=0 bulkscore=0 adultscore=0 classifier=spam adjust=0 reason=mlx engine=6.0.2-1012030000 definitions=main-1103230105 From: Chuck Swiger In-reply-to: <21012F71-5038-45F1-98C6-72A0B1239009@d3photography.com> Date: Wed, 23 Mar 2011 12:11:30 -0700 Message-id: <31D3BED1-7035-435F-B127-EFAAF6AFF076@mac.com> References: <21012F71-5038-45F1-98C6-72A0B1239009@d3photography.com> To: Ryan Coleman X-Mailer: Apple Mail (2.1084) 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 19:11:37 -0000 Hi-- On Mar 23, 2011, at 11:49 AM, Ryan Coleman wrote: > Disc images are located in /mount/disc_images/ (all are ISOs) > They need to mount into /mount/office_files/images/FILENAME [without the .iso extension] > > How can I do this? I've always been given these types of scripts in the past at an old job but I don't have access to those examples anymore. Something like this might do (untested, though): #! /bin/sh for FILE in /mount/disc_images/*; do DEST=$FILE:r mount -t cd9660 /dev/`mdconfig -f ${FILE}` /mount/office_files/images/${DEST} done Might need to add quotes if you have spaces or other unusual characters in your ISO filenames.... Regards, -- -Chuck