How to use clipboard data in bash script? [duplicate]

The name of the pictureThe name of the pictureThe name of the pictureClash 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










share|improve this 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.


















    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










    share|improve this 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.
















      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










      share|improve this question
















      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






      share|improve this question















      share|improve this question













      share|improve this question




      share|improve this question








      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.






















          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?






          share|improve this answer










          New contributor




          Morris is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
          Check out our Code of Conduct.

















          • 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

















          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?






          share|improve this answer










          New contributor




          Morris is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
          Check out our Code of Conduct.

















          • 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














          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?






          share|improve this answer










          New contributor




          Morris is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
          Check out our Code of Conduct.

















          • 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












          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?






          share|improve this answer










          New contributor




          Morris is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
          Check out our Code of Conduct.









          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?







          share|improve this answer










          New contributor




          Morris is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
          Check out our Code of Conduct.









          share|improve this answer



          share|improve this answer








          edited Nov 22 at 4:45





















          New contributor




          Morris is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
          Check out our Code of Conduct.









          answered Nov 22 at 3:35









          Morris

          313




          313




          New contributor




          Morris is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
          Check out our Code of Conduct.





          New contributor





          Morris is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
          Check out our Code of Conduct.






          Morris is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
          Check out our Code of Conduct.











          • 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




          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


          Popular posts from this blog

          How to check contact read email or not when send email to Individual?

          Christian Cage

          How to properly install USB display driver for Fresco Logic FL2000DX on Ubuntu?