== Fiddling with X selections from shell scripts I know of three command-line programs that will fiddle with the X selection (and/or the cut buffers) in a way that's useful for shell scripts: _xsnarf_ from Smarasderagd's [[collection of X things http://pantransit.reptiles.org/prog/#xthings]], [[xcb http://www.goof.com/pcg/marc/xcb.html]], and [[xclip http://people.debian.org/~kims/xclip/]]. I use _xsnarf_ for a variety of reasons, I think partly historical (in that I had it around well before I found the others); I'm jotting down the other two here partly so that I have the information handy the next time someone asks me about this. You may reasonably ask why this is actually interesting. Here's why: Shell scripts are the easy way to automate things on Unix. Doing things in X Windows sessions is no exception, but there you need some extra programs as building blocks. One of the important building blocks is some way to fiddle with the X selection (or the cut buffers); having this lets you set things up so that you can do things like select a URL in a terminal window and fire it into a browser. Yes, yes, some terminal emulators have this specific feature built in now. *Some*; making a shell script to do this means it works for anything that can make an X selection. Terminals. GNU Emacs. A help browser. *Everything*. I would much rather set up a general facility, once, than run around repeatedly adding yet another feature to yet another program, and hoping that I wedged it into all of the ones I care about. It's a lot easier, for a start, and it scales much better.