shell-scripts/inet/myip

3 lines
108 B
Bash
Executable file

#!/usr/bin/bash
ip addr | grep -Po '\d+\.\d+\.\d+\.\d+/24' | awk '{ print substr($1, 0, length($1) - 3) }'