I am writing a script that needs to replace the network cidr notation in the command with the one found by running a command . Is there a specific command that can tell me just the cidr notation for my network so i can then turn it into a variable and then use it in a command...... any help would be great...
Asked
Active
Viewed 776 times
0
-
Found this one.... works but does not show the / ....... – HtmlGifited Aug 16 '13 at 16:53
-
ip addr show |grep -w inet |grep -v 127.0.0.1|awk '{ print $2}'| cut -d "/" -f 2 – HtmlGifited Aug 16 '13 at 16:54
-
This one shows your loopback cidr and ur local area network cidr... – HtmlGifited Aug 16 '13 at 16:55
-
ip addr | awk '/inet / {sub(/\/.*/, "", $1); print $2}' | cut -d "/" -f 2 – HtmlGifited Aug 16 '13 at 16:56