finding the filesystem of a file

Conor P. Cahill cpcahil at virtech.uucp
Tue Nov 6 13:10:23 AEST 1990


In article <6495 at emory.mathcs.emory.edu> dt at mathcs.emory.edu (Dave Taylor {guest}) writes:
>Curious to know if anyone can tell me the fastest way to find out which
>filesystem a given file is on if the entire pathname is given.  I have only

Maybe not the fastest, but it will work:

lookup=path_to_look_up
len=0
filesys=`(mount; echo done) | while read fs junk
do
	if [ "x$fs" = "xdone" ]; then
		echo $lfs
	fi
	tlen=\`expr "x$lookup" : "x$fs"\`
	if [ "$tlen" -gt "$len" ]; then
		lfs="$fs"
		len="$tlen"
	fi

done`

echo "$filesys"


-- 
Conor P. Cahill            (703)430-9247        Virtual Technologies, Inc.,
uunet!virtech!cpcahil                           46030 Manekin Plaza, Suite 160
                                                Sterling, VA 22170 



More information about the Comp.unix.shell mailing list