Reputation: 265
I'm trying to login into multiple servers and execute the following command:
arp -an|grep lanx>lanx
I'm using this method:
ssh [email protected] arp\ -an|grep\ lanx >lanx
but it is not working its giving me an error
Upvotes: 0
Views: 671
Reputation: 2853
put in subshell. something like this will make things more clear:
(ssh xxxx arp -an) | grep lanx > /tmp/lanx
Upvotes: 0
Reputation: 784
ideally just put the commands in quotes like this:
ssh [email protected] '/sbin/arp -an | grep lanx' > lanx
or
ssh [email protected] '/sbin/arp -an' | grep lanx > lanx
The other problem might be the user admin on your machine does not have arp in PATH (is he root? arp is usually in /sbin/ and /sbin/ is usually not in PATH of a regular user.
Upvotes: 1