public inbox for cygwin@cygwin.com
 help / color / mirror / Atom feed
* Sending data to a script over SSH
@ 2009-07-01  6:42 Chap Harrison
  2009-07-01  6:59 ` Andrew DeFaria
  2009-07-01  7:38 ` Dave Korn
  0 siblings, 2 replies; 5+ messages in thread
From: Chap Harrison @ 2009-07-01  6:42 UTC (permalink / raw)
  To: cygwin

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.

 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.   
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).

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?

I hope that makes some sense.  And, obviously, the problem is not  
really about "clipboards" per se, but rather any input stream.

Thanks,
Chap Harrison

--
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

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: Sending data to a script over SSH
  2009-07-01  6:42 Sending data to a script over SSH Chap Harrison
@ 2009-07-01  6:59 ` Andrew DeFaria
  2009-07-15 17:30   ` Chap Harrison
  2009-07-01  7:38 ` Dave Korn
  1 sibling, 1 reply; 5+ messages in thread
From: Andrew DeFaria @ 2009-07-01  6:59 UTC (permalink / raw)
  To: cygwin

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

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: Sending data to a script over SSH
  2009-07-01  6:42 Sending data to a script over SSH Chap Harrison
  2009-07-01  6:59 ` Andrew DeFaria
@ 2009-07-01  7:38 ` Dave Korn
  1 sibling, 0 replies; 5+ messages in thread
From: Dave Korn @ 2009-07-01  7:38 UTC (permalink / raw)
  To: cygwin

Chap Harrison wrote:

> 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?

  SSh is a full bidirectional pipe, connected to the remote process.  You can
use any kind of redirection you like

< ... commands ... > | ssh user@host <scriptname>

ssh <file user@host <scriptname>

getclip | ssh user@host <scriptname> | putclip


  You might like to check the man page of those last two commands while you're
at it ;-)

  *doubletake*  Err, I mean, you might like to check the --help output from
them.  Couldn't find any documentation anywhere.

    cheers,
      DaveK


--
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

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: Sending data to a script over SSH
  2009-07-01  6:59 ` Andrew DeFaria
@ 2009-07-15 17:30   ` Chap Harrison
  2009-07-15 17:53     ` Dave Korn
  0 siblings, 1 reply; 5+ messages in thread
From: Chap Harrison @ 2009-07-15 17:30 UTC (permalink / raw)
  To: cygwin



defaria wrote:
> 
> 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.
> 

This is not *my* preferred way of doing things; it's the way my colleagues
are used to doing things.  To put it mildly, they don't work smart.  I'm
trying to gently introduce them to the amazing world of automation while not
upsetting them completely :-D .  Eventually, when they realize that Mr.
Computer can save them hours and days of mind-numbing drudgery and carpal
tunnel syndrome, the scales may fall from Mr. Boss-man's eyes and he'll ask
me to build something that'll be *really* easy to use.  


defaria wrote:
> 
>> 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?!?
> 

Well, not nearly so much as having it run in a separate machine.  I don't
know exactly how deeply it ties itself into the Windows OS (I know virtually
nothing about Windows), but I *do* know that if anything happened on the
Windows machine (that's shared by several users), suspicion would
immediately fall on Cygwin.  

My boss worked for IBM for ten years, in Marketing.  Fear, uncertainty, and
doubt run deep for him.  I'd like to run Cygwin directly on the "production"
machine (it has been superbly reliable for me) but superstition is tough to
battle directly.


-- 
View this message in context: http://www.nabble.com/Sending-data-to-a-script-over-SSH-tp24284928p24500709.html
Sent from the Cygwin list mailing list archive at Nabble.com.


--
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

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: Sending data to a script over SSH
  2009-07-15 17:30   ` Chap Harrison
@ 2009-07-15 17:53     ` Dave Korn
  0 siblings, 0 replies; 5+ messages in thread
From: Dave Korn @ 2009-07-15 17:53 UTC (permalink / raw)
  To: cygwin

Chap Harrison wrote:
> 
> defaria wrote:
>> 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.
>>
> 
> This is not *my* preferred way of doing things; it's the way my colleagues
> are used to doing things.  To put it mildly, they don't work smart.  I'm
> trying to gently introduce them to the amazing world of automation while not
> upsetting them completely :-D .  Eventually, when they realize that Mr.
> Computer can save them hours and days of mind-numbing drudgery and carpal
> tunnel syndrome, the scales may fall from Mr. Boss-man's eyes and he'll ask
> me to build something that'll be *really* easy to use.  

  Failing that, you at least have a rich seam of material to mine for stories
to submit to http://thedailywtf.com/ :-/

> defaria wrote:

>> 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?!?
> 
> Well, not nearly so much as having it run in a separate machine.  I don't
> know exactly how deeply it ties itself into the Windows OS (I know virtually
> nothing about Windows), but I *do* know that if anything happened on the
> Windows machine (that's shared by several users), suspicion would
> immediately fall on Cygwin.  

  For the record, Cygwin does not "tie itself into the OS" deeply or even at
all, not in the slightest.  It is an entirely ordinary windows program running
in user mode.  It has the ability to install services (which are also just
ordinary user-mode executables), and there is in one case - libusb - a
kernel-mode device driver; you'd want to not install that.  But that one
exception aside, everything cygwin is and does is just a win32 program and a
bunch of win32 DLLs.  It cannot BSoD the machine, crash non-cygwin processes,
or corrupt the kernel, it does not do low-level disk i/o, it no more hooks
itself into the OS than notepad or solitaire.

> My boss worked for IBM for ten years, in Marketing.  Fear, uncertainty, and
> doubt run deep for him.  I'd like to run Cygwin directly on the "production"
> machine (it has been superbly reliable for me) but superstition is tough to
> battle directly.

  Oh dear, doesn't sound like mere facts alone will be much use to you!

    cheers,
      DaveK


--
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

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2009-07-15 16:04 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-07-01  6:42 Sending data to a script over SSH Chap Harrison
2009-07-01  6:59 ` Andrew DeFaria
2009-07-15 17:30   ` Chap Harrison
2009-07-15 17:53     ` Dave Korn
2009-07-01  7:38 ` Dave Korn

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).