Is it possible to pipe to/from the clipboard in bash? Whether it's piping to/from a device handle or using an auxiliary application, I can't find anything.
For example, if /dev/clip was a device linking to the clipboard we could do:
cat /dev/clip # dump the contents of the clipboard
cat foo > /dev/clip # dump the contents of "foo" into the clipboard
-
There are different clipboards in linux, the X server has one, the window manager might have another one, etc. There is no standard device.
Oh, yes, on CLI, the screen program has its own clipboard as well, as do some other applications like emacs and vi.
In X, you can use xclip.
You can check this thread for other possible answers: http://unix.derkeiler.com/Newsgroups/comp.unix.shell/2004-07/0919.html
T.E.D. : It sounds like creating /dev/clip would be a good project for someone.marcog : I am perfectly aware of the multiple clipboards. How does this make my question any more difficult to answer?Sunny : Check the edits, I needed time to get the resources. -
marcog : Sweet, this is perfect! :)
-
You're a little ambiguous. I expect you're probably a Linux user inside X who wants to put stuff in the X
PRIMARYclipboard.It's important to understand that
bashdoesn't have a clipboard. There is no such thing as "the" clipboard, becausebashcan run on Windows, Mac OS X, lots of other OSes, inside X, outside X, ... Not to mention that X itself has three different clipboards itself. There's a wealth of clipboards you could be dealing with. Usually the clipboard you want to talk to has a utility that lets you talk to it.In case of X, yes, there's
xclip(and others).If you're trying to talk to the Mac OS X clipboard, there's
pbcopy.If you're in Linux terminal mode (no X) then maybe you need to look into
gpm.There's also GNU
screenwhich has a clipboard. To put stuff in there, look at thescreencommand "readreg".For Windows, I expect
cygwinwill have a tool.
0 comments:
Post a Comment