delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2009/07/01/02:59:40

X-Recipient: archive-cygwin AT delorie DOT com
X-SWARE-Spam-Status: No, hits=-3.0 required=5.0 tests=AWL,BAYES_00,RCVD_IN_DNSWL_LOW,SPF_HELO_PASS,SPF_PASS
X-Spam-Check-By: sourceware.org
To: cygwin AT cygwin DOT com
From: Andrew DeFaria <Andrew AT DeFaria DOT com>
Subject: Re: Sending data to a script over SSH
Date: Tue, 30 Jun 2009 23:59:04 -0700
Lines: 48
Message-ID: <h2f1fo$3ih$1@ger.gmane.org>
References: <59BFA592-AAB6-4120-9339-C10F472CA385 AT pobox DOT com>
Mime-Version: 1.0
User-Agent: Thunderbird 2.0.0.22 (X11/20090608)
In-Reply-To: <59BFA592-AAB6-4120-9339-C10F472CA385@pobox.com>
X-Stationery: 0.4.9
X-IsSubscribed: yes
Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm
List-Id: <cygwin.cygwin.com>
List-Unsubscribe: <mailto:cygwin-unsubscribe-archive-cygwin=delorie DOT com AT cygwin DOT com>
List-Subscribe: <mailto:cygwin-subscribe AT cygwin DOT com>
List-Archive: <http://sourceware.org/ml/cygwin/>
List-Post: <mailto:cygwin AT cygwin DOT com>
List-Help: <mailto:cygwin-help AT cygwin DOT com>, <http://sourceware.org/ml/#faqs>
Sender: cygwin-owner AT cygwin DOT com
Mail-Followup-To: cygwin AT cygwin DOT com
Delivered-To: mailing list cygwin AT cygwin DOT com

Chap Harrison wrote:
> This question may well be non-specific to Cygwin, and perhaps more of 
> an SSH or a Unix shell question.  If you can suggest a better forum 
> I'd appreciate it!
>
> The task is to fill out an Excel worksheet, copy a rectangular portion 
> to the Windows clipboard, have a script read the clipboard, transform 
> the data, and write the results back out to the Windows clipboard so 
> that the user can then paste it into a text document.
Why are you trying to deal with a very manual, step by step, point and 
click method of thinking and doing? The basic task here is to get data 
from an Excel worksheet (which is not a good input method to start with) 
to a text file. There are programmatic ways to do this. You can, for 
example, extract data from an Excel spreadsheet using Perl.
> From Cygwin, I can get at the clipboard through /dev/clipboard - very 
> handy indeed!  Only problem is that this requires that Cygwin be 
> running in the same copy of Windows from which I'm doing the cutting 
> and pasting.  This turns out to be a hard sell to management, who'd 
> prefer that I keep Cygwin running in its own Windows environment.
This part didn't parse for me. Wouldn't running Cygwin on the machine 
you are doing the cutting and pasting be it's own Windows environment?!?
> I've set up ssh and can now start a PuTTY session from my Excel world 
> into my Cygwin world (which is fine - a lot my scripts *don't* require 
> reading/writing the clipboard).
Why's Putty involved? Cygwin has OpenSSH.
> I'm wondering how to send a script invocation followed by the 
> clipboard data that the script will read and transform.  I know how to 
> use ssh to send a command to a remote system; I can do that from DOS.  
> But is there any way to say "run this command and, by the way, the 
> data it needs is right behind it"?  Sort of like an input redirection 
> with a HERE-doc, to put it very loosely?
If we are playing fast and lose then couldn't you:

    $ cat /dev/clipboard > /tmp/$$
    $ scp /tmp/$$ <remoteSystem>:/tmp/$$
    $ rm /tmp/$$
    $ ssh <remoteSystem> <script> < /tmp/$$ 

> I hope that makes some sense.  And, obviously, the problem is not 
> really about "clipboards" per se, but rather any input stream.
If it's not about clipboards or Excel for that matter then why are you 
introducing that complexity. Simply put the data in a file and 
manipulate the file...
-- 
Andrew DeFaria <http://defaria.com>
When I was a kid I used to pray every night for a new bicycle. Then I 
realised that the Lord doesn't work that way so I stole one and asked 
Him to forgive me.


--
Problem reports:       http://cygwin.com/problems.html
FAQ:                   http://cygwin.com/faq/
Documentation:         http://cygwin.com/docs.html
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019