Passing clipboard content to bash variable
Passing clipboard content to bash variable
#!/bin/bash
url = 'xclip -o -selection clipboard'
/usr/bin/palemoon url
# clipboard content is "www.my.yahoo.com"
# result: palemoon opens url.com not yahoo
# xenialpup 7.5 64bit
# Can anyone tell this newbie where I went wrong? Thanks.
url = 'xclip -o -selection clipboard'
/usr/bin/palemoon url
# clipboard content is "www.my.yahoo.com"
# result: palemoon opens url.com not yahoo
# xenialpup 7.5 64bit
# Can anyone tell this newbie where I went wrong? Thanks.
Haven't tested but maybe it should be:
Code: Select all
url=$(xclip -o -selection clipboard)
/usr/bin/palemoon $url
Then you must work with the command
What is the output of?
Alternatively
Just to verify - what is the output of?
Code: Select all
url=$(xclip -o -selection clipboard)
Code: Select all
echo $url
Alternatively
Code: Select all
echo ${url}
Code: Select all
xclip -o -selection clipboard
Ok, the output of :
and
Produces the clipboard url "my.yahoo.com"
produces output "url"
produces nothing[/code][/quote][/code]
Code: Select all
xclip -o -selection clipboard
Code: Select all
xclip -o clipboard
Code: Select all
echo url
Code: Select all
echo $url
Try sending the output to a temporary text file:
If you paste this straight into a terminal, and run it, then url will equal the above code, as it will always be the last thing copied.
[EDIT] Looks like you got a better answer anyway.
Code: Select all
xclip -o -selection clipboard > clip.txt
url=$(cat clip.txt)
echo $url
[EDIT] Looks like you got a better answer anyway.
I appreciate that there are more than one way to get results. Thanks.
The reason for this exercise was to be able to write a small script that opens chromium urls in palemoon.
http://murga-linux.com/puppy/viewtopic. ... 577#992577
The reason for this exercise was to be able to write a small script that opens chromium urls in palemoon.
http://murga-linux.com/puppy/viewtopic. ... 577#992577
Hi fmen.
I suppose that you already know that if you type an URL such as
www.my.yahoo.com in console (or you can paste it in the console with
middle-click from anywhere) and then single-left-click on it, this URL will
open in your default browser.
BFN.
I suppose that you already know that if you type an URL such as
www.my.yahoo.com in console (or you can paste it in the console with
middle-click from anywhere) and then single-left-click on it, this URL will
open in your default browser.
BFN.
musher0
~~~~~~~~~~
"You want it darker? We kill the flame." (L. Cohen)
~~~~~~~~~~
"You want it darker? We kill the flame." (L. Cohen)
Tallboy,tallboy wrote:musher0, that depends on which terminal you use, and how it is set up. Traditionally, mouse clicks don't have anything to do in a term window!
you made me fall off my chair! Please explain!
Don't all Puppies come with gpm (the "general purpose mouse") installed at
/usr/sbin/gpm and /usr/lib/gpm, and activated through /etc/init.d/gpm?
Plus: this cannot be all wrong, can it?
https://wiki.archlinux.org/index.php/Co ... a_terminal
BFN.
musher0
~~~~~~~~~~
"You want it darker? We kill the flame." (L. Cohen)
~~~~~~~~~~
"You want it darker? We kill the flame." (L. Cohen)
musher0, I use a urxvt terminal window.
I can paste previously selected text by a middle-click.
With the left button, I can select text in a terminal window by dragging, double-clicking or triple-clicking, and the text is copied.
If I click on text in the terminal, nothing happens, unless I start dragging it to select some text.
I have never been able to single-click on an url to make it open in a browser.
Neat trick, but it must create trouble if you just click to start copying some text?
I can paste previously selected text by a middle-click.
With the left button, I can select text in a terminal window by dragging, double-clicking or triple-clicking, and the text is copied.
If I click on text in the terminal, nothing happens, unless I start dragging it to select some text.
I have never been able to single-click on an url to make it open in a browser.
Neat trick, but it must create trouble if you just click to start copying some text?
True freedom is a live Puppy on a multisession CD/DVD.
Programming section : Click in terminal
What i know is that previous commands are in history
if you type first your preferred sites, then use history
i ws just checking topics in this programmers forum.. Yes, really not my cup of tea..
if you type first your preferred sites, then use history
i ws just checking topics in this programmers forum.. Yes, really not my cup of tea..