[Gllug] Bash Question - My Brain's not working tonight

Ken Smith kens at kensnet.org
Sun Aug 26 21:07:09 UTC 2007


Hi, I writing a simple backup script with bash. But my string 
programming is all messed up - I'm really inexperienced in this area. 
The script is to use rsync to backup a CIFS share from a Win box.

I want to check to see if  the share is already mounted for whatever 
reason.

I have the machine name in $1 and the share name is $2

so what I want to do is

mount | grep //$1/$2 and then use an if statement based on the value of $?

where in this case

$1 is trh2003.trhbeith.local

and $2 is e$

and the whole string I'm looking for in the mount output is 
//trh2003.trhbeith.local/e$

But somehow the "/'s" are getting mashed somewhere.

I'm sure there is a way to do this but I can't fathom it tonight.

I'd like to refine my bash string programming understanding rather than 
skinning this cat a completely different way. I'm sure I could do this 
is php or perl but I'm sure bash can do this.


Thanks in advance

Ken



-- 
This message has been scanned for viruses and
dangerous content by MailScanner, and is
believed to be clean.

-- 
Gllug mailing list  -  Gllug at gllug.org.uk
http://lists.gllug.org.uk/mailman/listinfo/gllug




More information about the GLLUG mailing list