ML
    • Recent
    • Categories
    • Tags
    • Popular
    • Users
    • Groups
    • Register
    • Login

    Use clipboard contents with Bash

    Scheduled Pinned Locked Moved IT Discussion
    4 Posts 3 Posters 351 Views
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • stacksofplatesS
      stacksofplates
      last edited by stacksofplates

      So I had a scenario where I needed to connect to a few servers on the same port. You just need to copy the server name and run this script. This is a very specific example, but this is more to show how you can use the clipboard without pasting.

      As this script implies, you need xclip installed as well.

      #!/bin/bash
      
      SERVER=$(xclip -o)
      
      ssh -L 8080:$SERVER:8080 server.example.com
      
      1 Reply Last reply Reply Quote 3
      • ObsolesceO
        Obsolesce
        last edited by

        Am I misunderstanding something? Because I have always used ctrl+shift+V to paste clipboard text into the terminal.

        JaredBuschJ 1 Reply Last reply Reply Quote 0
        • JaredBuschJ
          JaredBusch @Obsolesce
          last edited by

          @obsolesce said in Use clipboard contents with Bash:

          Am I misunderstanding something?

          Yes. This is the script reading the clipboard into a variable.

          ObsolesceO 1 Reply Last reply Reply Quote 2
          • ObsolesceO
            Obsolesce @JaredBusch
            last edited by

            @jaredbusch said in Use clipboard contents with Bash:

            @obsolesce said in Use clipboard contents with Bash:

            Am I misunderstanding something?

            Yes. This is the script reading the clipboard into a variable.

            Oh I see now, that's pretty neat.

            1 Reply Last reply Reply Quote 0
            • 1 / 1
            • First post
              Last post