Skip to content

Instantly share code, notes, and snippets.

@rewida17
Created January 6, 2018 00:55
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save rewida17/2d907712b52ec0a6599b7de8afb0de19 to your computer and use it in GitHub Desktop.
Save rewida17/2d907712b52ec0a6599b7de8afb0de19 to your computer and use it in GitHub Desktop.
Get yours actuall IP addr on Iface
#!/bin/bash
ip addr | grep -i "wls3" | tail -n1 |sed "s/inet//g" | sed "s/\/24/\\n/g" | head -n1
#How it`s work
#Print info about network Iface ( print using \n not \f and only IPv4 address)
#ip -0 -4 addr|\
#Get some info about specific Iface
#grep -i "wls3" |\
#tail -n1 |\
#remove "inet"
#sed "s/inet//g" |\
#Replace internet mask by new line mark
#sed "s/\/24/\\n/g" |\
#Print address
#head -n1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment