LinuxQuestions.org
Register a domain and help support LQ
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - General
User Name
Password
Linux - General This Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.

Notices

Reply
 
Search this Thread
Old 02-22-2013, 07:44 AM   #1
frisil
LQ Newbie
 
Registered: Feb 2010
Location: behind you ;-)
Distribution: SimplyMepis
Posts: 17

Rep: Reputation: 1
How to get selected text into a terminal command?


Hi,
I want to do the following: Invoke a mouse gesture sending a terminal command to open firefox and google for whatever text was selected.

Therefore I need a way to make the command access the buffer containing selected text (the one that can be pasted by middle clicking). Is there a system variable for that? Or how do I do it?

To be more precise, if I selected the text "grub" with the mouse in any application, I need a bash command that will echo it back. Like calling a command "getmouseselection" in a terminal or bash script that will output "grub", or "echo $selectedtext" with the same output.

How can I do that?
 
Old 02-22-2013, 07:49 AM   #2
catkin
LQ 5k Club
 
Registered: Dec 2008
Location: Tamil Nadu, India
Distribution: Servers: Debian Squeeze and Wheezy. Desktop: Slackware64 14.0. Netbook: Slackware 13.37
Posts: 8,563
Blog Entries: 29

Rep: Reputation: 1179Reputation: 1179Reputation: 1179Reputation: 1179Reputation: 1179Reputation: 1179Reputation: 1179Reputation: 1179Reputation: 1179
xclip or xsel (very similar functionality) may do what you want.
 
1 members found this post helpful.
Old 02-22-2013, 08:00 AM   #3
frisil
LQ Newbie
 
Registered: Feb 2010
Location: behind you ;-)
Distribution: SimplyMepis
Posts: 17

Original Poster
Rep: Reputation: 1
Quote:
Originally Posted by catkin View Post
xclip or xsel (very similar functionality) may do what you want.
Thanks a lot! xsel is exactly what I was looking for!
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
copying selected text using vi aceone Red Hat 7 11-20-2010 07:01 AM
openoffice 2.4 text field cannot be selected 105659 Linux - Software 4 06-23-2008 12:29 PM
Cannot print selected text dwhitney67 Linux - General 0 09-30-2007 01:42 AM
VI : Copying Selected Text Chaitanyayardi Linux - Software 1 11-10-2005 08:40 AM
Empty terminal [command line] with no text after kernel upgrade to 2.6.7 whencat Red Hat 7 07-09-2004 04:59 PM


All times are GMT -5. The time now is 03:50 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration