Skip to content

Instantly share code, notes, and snippets.

@mxdevmanuel
Created April 17, 2020 17:29
Show Gist options
  • Save mxdevmanuel/60017242736ba9641fda9b0bfd3a8aa6 to your computer and use it in GitHub Desktop.
Save mxdevmanuel/60017242736ba9641fda9b0bfd3a8aa6 to your computer and use it in GitHub Desktop.
Select, copy and paste ip address from list (requires xclip, xdotool, fzf and/or dmenu)
#!/bin/env bash
TOOL=dmenu
if [[ -t 1 ]]; then
TOOL=fzf
fi
ADDR=$(ip -oneline -4 addr | awk '{print $2, $4}'| $TOOL | awk '{print $2}' | perl -pe 's/\/\d+//')
echo $ADDR | xclip -i -selection clipboard
xdotool type --clearmodifiers "$ADDR"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment