Skip to content

Instantly share code, notes, and snippets.

@robmiller
Created October 7, 2013 13:34
Show Gist options
  • Save robmiller/6868129 to your computer and use it in GitHub Desktop.
Save robmiller/6868129 to your computer and use it in GitHub Desktop.
I often want to copy the IP address for a hostname to my clipboard. This shell function will do that; drop it in your `.bashrc` or `.zshrc` and you can then call `nscp example.com` to copy the A record for `example.com` to your clipboard. It also outputs it, so you can verify it by eye (or pipe it into something else).
function nscp() {
nslookup $1 | sed -n 'x;$p' | cut -d' ' -f2 | tee >(pbcopy)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment