Operating System - HP-UX
1752746 Members
4912 Online
108789 Solutions
New Discussion

Re: find if under one filesystem other filesystems are mounted

 
SOLVED
Go to solution
Dennis Handly
Acclaimed Contributor
Solution

Re: find if under one filesystem other filesystems are mounted

You may want to do a better job matching

awk -v FSYS="/filesystem" '
BEGIN {found=0}
$2 == FSYS || $2 ~ ("^" FSYS "/") {
   found += 1
   print $0
}
END { print found }' /etc/mnttab

 

support_billa
Valued Contributor

Re: find if under one filesystem other filesystems are mounted

great , you improve my awk so perfect that i have following idea :

 

when i have  following filesystem(s)

/filesystem
/filesystem/fs1
/filesystem/fs2

 

and i want to umount /filesystem , so i have to search for :

/filesystem/fs1
/filesystem/fs2

 

with

 

awk -v FSYS="/filesystem" '
BEGIN {found=0}
$2 ~ ("^" FSYS "/") {
   found += 1
   print $0
}
END { print found }' /etc/mnttab

 

Spoiler