Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/bin/bash
- ivp4_pattern='/^([0-9]{1,3}.){3}[0-9]{1,3}(/([0-9]|[1-2][0-9]|3[0-2]))?$/igm'
- networks=$(ip addr | grep "inet" | awk '{print $2}')
- while read -r line;
- do
- echo "$line"
- done <<< "$networks"
- echo "$ivp4_pattern"
- echo "$networks" | grep "$ivp4_pattern"
- [jonathan@localhost ~]$ ./script.sh
- 127.0.0.1/8
- ::1/128
- 172.16.155.128/24
- fe80::da84:977a:d654:7716/64
- /^([0-9]{1,3}.){3}[0-9]{1,3}(/([0-9]|[1-2][0-9]|3[0-2]))?$/igm
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement