我已经尝试过这个建议:
ip -o -f inet addr show | awk '/scope global/ {print $4}'
但输出带有子网掩码的 IP 地址:
192.168.1.108/24
我只想要号码 24
24
linux bash grep sh subnet
bash ×1
grep ×1
linux ×1
sh ×1
subnet ×1