How to use clipboard data in bash script? [duplicate]
Clash Royale CLAN TAG#URR8PPP
up vote
0
down vote
favorite
This question already has an answer here:
Print the system clipboard content in bash
2 answers
I very often use a simple curl command to get IP addresses details.
curl ipinfo.io/111.222.333.444
Almost everytime I got the IP address in the clipboard
Is there a way to use a bash variable to automatically have the clipboard value use for IP address?
Ideally I'd like to create an alias
Alias iploc = 'curl ipinfo.io/pbcopy'
So then each time I copy an ip address in clipboard I can just type "iploc" in terminal and get the result.
l
bash clipboard
marked as duplicate by Ipor Sircer, Sparhawk, Rui F Ribeiro, JigglyNaga, GAD3R Nov 22 at 9:26
This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.
add a comment |
up vote
0
down vote
favorite
This question already has an answer here:
Print the system clipboard content in bash
2 answers
I very often use a simple curl command to get IP addresses details.
curl ipinfo.io/111.222.333.444
Almost everytime I got the IP address in the clipboard
Is there a way to use a bash variable to automatically have the clipboard value use for IP address?
Ideally I'd like to create an alias
Alias iploc = 'curl ipinfo.io/pbcopy'
So then each time I copy an ip address in clipboard I can just type "iploc" in terminal and get the result.
l
bash clipboard
marked as duplicate by Ipor Sircer, Sparhawk, Rui F Ribeiro, JigglyNaga, GAD3R Nov 22 at 9:26
This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.
add a comment |
up vote
0
down vote
favorite
up vote
0
down vote
favorite
This question already has an answer here:
Print the system clipboard content in bash
2 answers
I very often use a simple curl command to get IP addresses details.
curl ipinfo.io/111.222.333.444
Almost everytime I got the IP address in the clipboard
Is there a way to use a bash variable to automatically have the clipboard value use for IP address?
Ideally I'd like to create an alias
Alias iploc = 'curl ipinfo.io/pbcopy'
So then each time I copy an ip address in clipboard I can just type "iploc" in terminal and get the result.
l
bash clipboard
This question already has an answer here:
Print the system clipboard content in bash
2 answers
I very often use a simple curl command to get IP addresses details.
curl ipinfo.io/111.222.333.444
Almost everytime I got the IP address in the clipboard
Is there a way to use a bash variable to automatically have the clipboard value use for IP address?
Ideally I'd like to create an alias
Alias iploc = 'curl ipinfo.io/pbcopy'
So then each time I copy an ip address in clipboard I can just type "iploc" in terminal and get the result.
l
This question already has an answer here:
Print the system clipboard content in bash
2 answers
bash clipboard
bash clipboard
edited Nov 22 at 6:28
Rui F Ribeiro
38.3k1475126
38.3k1475126
asked Nov 22 at 3:20
Laurent
92
92
marked as duplicate by Ipor Sircer, Sparhawk, Rui F Ribeiro, JigglyNaga, GAD3R Nov 22 at 9:26
This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.
marked as duplicate by Ipor Sircer, Sparhawk, Rui F Ribeiro, JigglyNaga, GAD3R Nov 22 at 9:26
This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.
add a comment |
add a comment |
1 Answer
1
active
oldest
votes
up vote
3
down vote
You can use xsel
to access the clipboard
iploc='curl ipinfo.io/$(xsel -o)'
see also Pipe to/from the clipboard in Bash script and How do I send stdin to the clipboard?
New contributor
Thanks Morris. I realised that I did not mention I was on MacOS. I believe xsel is Linux only. I did some research and pbpaste seems to be the equivalent for MacOS. Created that alias: alias iploc='curl ipinfo.io/$(pbpaste)' Works like a charm. Thanks again for pointing me in the right direction.
– Laurent
22 hours ago
add a comment |
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
up vote
3
down vote
You can use xsel
to access the clipboard
iploc='curl ipinfo.io/$(xsel -o)'
see also Pipe to/from the clipboard in Bash script and How do I send stdin to the clipboard?
New contributor
Thanks Morris. I realised that I did not mention I was on MacOS. I believe xsel is Linux only. I did some research and pbpaste seems to be the equivalent for MacOS. Created that alias: alias iploc='curl ipinfo.io/$(pbpaste)' Works like a charm. Thanks again for pointing me in the right direction.
– Laurent
22 hours ago
add a comment |
up vote
3
down vote
You can use xsel
to access the clipboard
iploc='curl ipinfo.io/$(xsel -o)'
see also Pipe to/from the clipboard in Bash script and How do I send stdin to the clipboard?
New contributor
Thanks Morris. I realised that I did not mention I was on MacOS. I believe xsel is Linux only. I did some research and pbpaste seems to be the equivalent for MacOS. Created that alias: alias iploc='curl ipinfo.io/$(pbpaste)' Works like a charm. Thanks again for pointing me in the right direction.
– Laurent
22 hours ago
add a comment |
up vote
3
down vote
up vote
3
down vote
You can use xsel
to access the clipboard
iploc='curl ipinfo.io/$(xsel -o)'
see also Pipe to/from the clipboard in Bash script and How do I send stdin to the clipboard?
New contributor
You can use xsel
to access the clipboard
iploc='curl ipinfo.io/$(xsel -o)'
see also Pipe to/from the clipboard in Bash script and How do I send stdin to the clipboard?
New contributor
edited Nov 22 at 4:45
New contributor
answered Nov 22 at 3:35
Morris
313
313
New contributor
New contributor
Thanks Morris. I realised that I did not mention I was on MacOS. I believe xsel is Linux only. I did some research and pbpaste seems to be the equivalent for MacOS. Created that alias: alias iploc='curl ipinfo.io/$(pbpaste)' Works like a charm. Thanks again for pointing me in the right direction.
– Laurent
22 hours ago
add a comment |
Thanks Morris. I realised that I did not mention I was on MacOS. I believe xsel is Linux only. I did some research and pbpaste seems to be the equivalent for MacOS. Created that alias: alias iploc='curl ipinfo.io/$(pbpaste)' Works like a charm. Thanks again for pointing me in the right direction.
– Laurent
22 hours ago
Thanks Morris. I realised that I did not mention I was on MacOS. I believe xsel is Linux only. I did some research and pbpaste seems to be the equivalent for MacOS. Created that alias: alias iploc='curl ipinfo.io/$(pbpaste)' Works like a charm. Thanks again for pointing me in the right direction.
– Laurent
22 hours ago
Thanks Morris. I realised that I did not mention I was on MacOS. I believe xsel is Linux only. I did some research and pbpaste seems to be the equivalent for MacOS. Created that alias: alias iploc='curl ipinfo.io/$(pbpaste)' Works like a charm. Thanks again for pointing me in the right direction.
– Laurent
22 hours ago
add a comment |