LinuxQuestions.org
Latest LQ Deal: Latest LQ Deals
Home Forums Tutorials Articles Register
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, 06: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, 06:49 AM   #2
catkin
LQ 5k Club
 
Registered: Dec 2008
Location: Tamil Nadu, India
Distribution: Debian
Posts: 8,578
Blog Entries: 31

Rep: Reputation: 1208Reputation: 1208Reputation: 1208Reputation: 1208Reputation: 1208Reputation: 1208Reputation: 1208Reputation: 1208Reputation: 1208
xclip or xsel (very similar functionality) may do what you want.
 
1 members found this post helpful.
Old 02-22-2013, 07: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



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 06:01 AM
openoffice 2.4 text field cannot be selected 105659 Linux - Software 4 06-23-2008 11:29 AM
Cannot print selected text dwhitney67 Linux - General 0 09-30-2007 12:42 AM
VI : Copying Selected Text Chaitanyayardi Linux - Software 1 11-10-2005 07:40 AM
Empty terminal [command line] with no text after kernel upgrade to 2.6.7 whencat Red Hat 7 07-09-2004 03:59 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - General

All times are GMT -5. The time now is 12:19 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
Open Source Consulting | Domain Registration