Cygwin: Safe to `cp Some/File.txt /dev/clipboard`?

0

I know that there is putlcip and getclip, but sometimes, I just want to deal with files. I know that I can cp from /dev/clipboard to another file, and the result is a text file with the same permissions as /dev/clipboard.

Is it safe to issue the command cp Some/File.txt /dev/clipboard?

I don't want to try it in case I overwrite /dev/clipboard in unintended ways, e.g., turn it from a device into a regular text file.

user2153235

Posted 2020-02-19T23:33:15.237

Reputation: 203

Answers

1

/dev/clipboard is a special cygwin file.
If you look with explorer the dev directory it does NOT exist in Windows.

cat Some/File.txt > /dev/clipboard 

works fine and similar with cp

matzeri

Posted 2020-02-19T23:33:15.237

Reputation: 1 662

Thanks for that. I do wonder, though, what was your backup plan if your attempt at the above command has clobbered /dev/clipboard and made it into something other than the special Cygwin file that it is? – user2153235 – 2020-02-20T11:38:34.193

It is not too difficult to reinstall any package ;-) and I already know something about Cygwin https://cygwin.com/who.html

– matzeri – 2020-02-20T19:26:39.087

I know something about it too, but not what package sets up /dev/clipboard. A package search for /dev/clipboard turns up nothing, while a search for clipboard turns up too much . A google search for /dev/clipboard site:www.cygwin.com turns up postings rather than packages. That's why I was wondering what your recovery strategy was. I would have guessed that /dev/clipboard would be set up by the base Cygwin installation. – user2153235 – 2020-02-20T22:46:39.080

/dev devices are virtual creations of the cygwin1.dll – matzeri – 2020-02-21T05:52:57.757

Doesn't that mean re-installing a core component of Cygwin? It's still just a matter of selecting re-install in the installer? I'm guessing so, as surprising as that seems. After all, cygwin is presumably offline (not being used) during the re-install. – user2153235 – 2020-02-21T05:56:31.530

1I mean as the clipboard is a virtual creation and not a real file/object you can not 'overwrite' it. Of course the harddisks '/dev/sdxx' are a different matter as they are a interface to a real object and you can destroy them. – matzeri – 2020-02-21T14:41:52.590

Ah, OK. That's useful to know. And yes, this is completely in line fact that it does not exist in Windows Explorer. Thanks! – user2153235 – 2020-02-21T22:29:11.547