From owner-freebsd-questions@FreeBSD.ORG Wed Aug 17 20:25:28 2005 Return-Path: X-Original-To: freebsd-questions@freebsd.org Delivered-To: freebsd-questions@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 7145816A429 for ; Wed, 17 Aug 2005 20:25:28 +0000 (GMT) (envelope-from dan@dan.emsphone.com) Received: from dan.emsphone.com (dan.emsphone.com [199.67.51.101]) by mx1.FreeBSD.org (Postfix) with ESMTP id B63CB43D49 for ; Wed, 17 Aug 2005 20:25:27 +0000 (GMT) (envelope-from dan@dan.emsphone.com) Received: (from dan@localhost) by dan.emsphone.com (8.13.1/8.13.3) id j7HKPEWC061847; Wed, 17 Aug 2005 15:25:14 -0500 (CDT) (envelope-from dan) Date: Wed, 17 Aug 2005 15:25:14 -0500 From: Dan Nelson To: jdyke Message-ID: <20050817202514.GA60291@dan.emsphone.com> References: <20050817195522.28381.qmail@web50101.mail.yahoo.com> <43039A20.7030803@azimainc.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <43039A20.7030803@azimainc.com> X-OS: FreeBSD 5.4-STABLE X-message-flag: Outlook Error User-Agent: Mutt/1.5.9i Cc: "Jorge Mario G. Mazo" , freebsd-questions@freebsd.org Subject: Re: how to know the file system type [programming] 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, 17 Aug 2005 20:25:28 -0000 In the last episode (Aug 17), jdyke said: > Jorge Mario G. Mazo wrote: > >hi there > >I've been looking for a way to check the fs type > >I need to do something like this > > > >if NTFS do this > >if msdis do that > >if ufs2 do that > >if ext2 do this other stuff > > not sure if this is what your looking for, but there are likely a million > ways, one being > > in bash any bourne shell, actually. > $ fs_to_check=/dev/ad4s1g > $ fstype=`grep $fs_to_check /etc/fstab | awk '{ print $3 }'` > $ echo $fstype > ufs Might be better to use the output of "mount -p" instead of /etc/fstab, since the filesystem may have been automounted or otherwise not in fstab. Unfortunately, mount -p doesn't take an argument to limit the output to just the filessytem listed.. -- Dan Nelson dnelson@allantgroup.com