Quantcast
Channel: Active questions tagged ruby - Stack Overflow
Viewing all articles
Browse latest Browse all 4615

How might I pass text data from the ruby console into my clipboard without saving to a file?

$
0
0

I'm trying to pass the array contained in a global variable I've created into my clipboard on my mac.

It is very long so I don't want to highlight, copy & paste on my console.

I want to use embedded unix code, specificially the pbcopy function for the mac laptop console that allows me to pass text into my computers clipboard, ready to paste.

Were I to do this with a file-save, I'd do something like this (in ruby):

stringdata = “kflxkhdoudopudpdpudpudpyddoyod”File.open("temp.txt"){|f| f.write(stringdata)}`cat temp.txt | pbcopy`

But could I possibly do this without creating a temporary file?

I'm sure this is possible. All things in text are possible. Thanks in advance for the solution


Viewing all articles
Browse latest Browse all 4615

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>