[CentOS] script help

Luciano Rocha strange at nsk.no-ip.org
Fri Oct 26 11:07:31 UTC 2007


On Fri, Oct 26, 2007 at 11:52:50AM +0100, Luciano Rocha wrote:
> On Fri, Oct 26, 2007 at 11:28:37AM +0100, Tom Brown wrote:
> >  Hi
> > 
> >  I am sure the answer here is really easy but i am stuck!
> > 
> >  # mount | grep data | awk '{print$1,$2,$3}'
> > 
> >  gives me the info i require locally, however i need to execute this over 
> >  about 1000 hosts so i run things remotely using ssh something like
> > 
> >  # MOUNTER=`ssh $i 'mount | grep data | awk '{print$1,$2,$3}''`
> > 
> >  however this fails as at the end of the line there are 2 ticks eg ' together 
> >  -
> > 
> >  Can anyone offer me some syntax help please?
> 
> Well, you don't need to run the grep and awk on the other side:
> 
> MOUNTER=`ssh $i mount | awk '/data/{print $1,$2,$3}'`
> 
> But you can live without the call to mount, too:
> MOUNTER=`ssh $i awk "'/data/{print $1,$2,$3}'" /etc/mtab`

Oops, wrong c&p:
MOUNTER=`ssh $i awk "'/data/{print \$1,\$2,\$3}'" /etc/mtab`

-- 
lfr
0/0
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: not available
Url : http://lists.centos.org/pipermail/centos/attachments/20071026/805986c9/attachment.bin


More information about the CentOS mailing list