Welcome to the MacNN Forums.

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

You are here: MacNN Forums > Software - Troubleshooting and Discussion > macOS > Remote information to local text file...how?

Remote information to local text file...how?
Thread Tools
BostonMACOSX
Forum Regular
Join Date: Nov 2000
Location: Boston Area,ma
Status: Offline
Reply With Quote
Oct 2, 2003, 03:05 PM
 
quick question which I just can't figure out.
If I want to ssh to a foreign machine run ifconfig and grep out some of the information and then write it to a local text file i'm thinking:

ssh username@host `ifconfig en0` | grep ether > test.txt

I always get 'ambiguous input redirect'.

Any Ideas on how to correct this.

Thanks

Robert
Bostonmacosx
OSX ...Plastic surgery for unix
Boston Area Consulting
http://rjhcc.dyndns.biz
http://bostonmacosx.dyndns.org
     
kampl
Dedicated MacNNer
Join Date: Jul 2002
Location: Boston, MA
Status: Offline
Reply With Quote
Oct 2, 2003, 06:24 PM
 
You can use RSA authentication instead so that you don't need to enter a password. Check out Macwrite Article 1 and Macwrite Article 2 . I used to do this to sync up CVS trees between machines. The only other thing I can think of is to use expect code.
     
BostonMACOSX  (op)
Forum Regular
Join Date: Nov 2000
Location: Boston Area,ma
Status: Offline
Reply With Quote
Oct 2, 2003, 07:49 PM
 
I can get to the remote machine just can't get the information back to the local machine.
OSX ...Plastic surgery for unix
Boston Area Consulting
http://rjhcc.dyndns.biz
http://bostonmacosx.dyndns.org
     
Lordie
Fresh-Faced Recruit
Join Date: May 2001
Status: Offline
Reply With Quote
Oct 2, 2003, 08:43 PM
 
You are so close!

Don't use backticks, just encapsulate your request in single quotes like this:

ssh foo@bar 'ls -la' |grep baz > out.txt

When in doubt, the -v option is your friend. Doing something like

ssh -v foo@bar `ifconfig en0`

will show you exactly what command you're sending to the server, which in this case would be the output of ifconfig on your local machine
     
   
 
Forum Links
Forum Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Top
Privacy Policy
All times are GMT -4. The time now is 05:12 AM.
All contents of these forums © 1995-2017 MacNN. All rights reserved.
Branding + Design: www.gesamtbild.com
vBulletin v.3.8.8 © 2000-2017, Jelsoft Enterprises Ltd.,