[CentOS] script help
Alfred von Campe
alfred at von-campe.com
Fri Oct 26 10:37:58 UTC 2007
On Oct 26, 2007, at 6:28, Tom Brown wrote:
> I am sure the answer here is really easy but i am stuck!
Getting the quoting right for remote commands in the shell is never
an easy thing :-).
> # 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?
I can usually get this to work with some trial an error by doubling
up quotes and using backslahes but it's a frustrating experience.
Instead, I use a different technique: I put a script in a network
accessible place (i.e., a common NFS mount) and then use ssh to
execute that script.
Alfred
More information about the CentOS
mailing list