Operating System - HP-UX
1847458 Members
3854 Online
110265 Solutions
New Discussion

Re: help I've lost the plot

 
SOLVED
Go to solution
Adam Noble
Super Advisor

help I've lost the plot

Hi,

I am trying to write a very simple ssh script to collect space information on a number of servers so I can simpy scp a depot file to install. If I run the following string on the command line all is well:-

ssh ${i} bdf /home/noddy | grep dev | awk '{print $4}' >/tmp/output

If I run the same command within a script the output file is created on the remote host and not locally. I have put the above comand string in double quotes within the script and it has none of it. How do I get round this I'm sure I've done this many times before.
2 REPLIES 2
James R. Ferguson
Acclaimed Contributor
Solution

Re: help I've lost the plot

Hi Adam:

Try double-quoting the redirection operator only:

# ssh ${i} bdf /home/noddy | grep dev | awk '{print $4}' ">" /tmp/output

Regards!

...JRF...
Adam Noble
Super Advisor

Re: help I've lost the plot

Thanks James I managed to work this out after playing around with the quotes. Basically if I double quote the command string and put a backslash infront of the variable i.e $4 then all was fine. Cheers anyway