Script tests if a file system is mounted. (SOLVED)

Using applications, configuring, problems
Post Reply
Message
Author
User avatar
sunburnt
Posts: 5090
Joined: Wed 08 Jun 2005, 23:11
Location: Arizona, U.S.A.

Script tests if a file system is mounted. (SOLVED)

#1 Post by sunburnt »

This code chunk gets the IP add., I'm trying to modify it.

MYIP=`ifconfig |grep "Bcast"| sed "s/^.*addr://" | sed "s/\w.*//"`
--------
This code checks the mount print out to see if a certain file system is mounted.
Error, first sed at char. 23, unknown command: `/'.

MNTFS=`mount |grep "on"| sed "/^\/\/160SEA\/PUPPYPC//" | sed "s/ //"`
----------
Bottom part of the the mount display, the part searched for is: //160SEA/PUPPYPC.

//160SEA/public on /mnt/public type smbfs (rw,nosuid,nodev,win95,file_mode=0755,dir_mode=0755)
//160SEA/docs on /mnt/docs type smbfs (ro,nosuid,nodev,win95,file_mode=0755,dir_mode=0755)
//160SEA/PUPPYPC on /home type smbfs (rw,nosuid,nodev,win95,file_mode=0755,dir_mode=0755)

Is there an easier way to do it? One would only hope!
Last edited by sunburnt on Sun 27 Nov 2005, 21:19, edited 1 time in total.

User avatar
MU
Posts: 13649
Joined: Wed 24 Aug 2005, 16:52
Location: Karlsruhe, Germany
Contact:

#2 Post by MU »

sed might be confused by the "/" in the foldernames.

Sed can use different delimters like "#"
MNTFS=`mount |grep "on"| sed "#^//160SEA/PUPPYPC##" | sed "s# ##"`

You also can use "." instead of "/".
"." means "one char of whatever type".
MNTFS=`mount |grep "on"| sed "#^..160SEA.PUPPYPC##" | sed "s# ##"`

Mark

User avatar
sunburnt
Posts: 5090
Joined: Wed 08 Jun 2005, 23:11
Location: Arizona, U.S.A.

#3 Post by sunburnt »

Thanks MU, I saw the . usage, but didn't think to use it in place of the 23 char. that was causing the problem.
This is what I needed, lots & lots of examples, your a scholar & a gentleman.

Post Reply