Paste a URL in terminal using bash script on Ubuntu

3

I'm on Ubuntu 12.04. I need to write a Bash script which would automatically paste a URL to the terminal without having to press CtrlShiftV on the keyboard.

The script contains the command:

wget -O "url"

The URL would already be copied before the script executes.

user3402248

Posted 2014-03-11T15:03:25.653

Reputation: 43

What operating system should this work on? What desktop environment / window manager are you running? – slhck – 2014-03-11T15:07:43.873

Iam using Ubuntu 12.04 – user3402248 – 2014-03-11T15:12:10.257

The windows manager is compiz – user3402248 – 2014-03-11T15:18:14.960

Answers

3

you can install xsel (sudo apt-get install xsel if not installed) and use:

wget -O $(xsel --clipboard)

laurent

Posted 2014-03-11T15:03:25.653

Reputation: 4 166

0

I have these two aliases to help me out in this kind of situation:

alias pbpaste='xclip -selection clipboard -o'
alias pbcopy='xclip -selection clipboard'

Then you can do things like:

wget -O $(pbpaste)

or

awk "/UG/ {print \$2}" <<(route -n) | pbcopy

SergioAraujo

Posted 2014-03-11T15:03:25.653

Reputation: 211