Sorry if this was asked before but I cant find a solution, except for Windows and regex. Both I am not familiar with.
I would like to validate a network-address like 192.168.1.0/24, or an IP like 192.168.1.1 .
This is what I came up with ...
if [[ "$1" =~ ^[1-255].[0-255].[0-255].0/[8-32]$ ]]; then
echo "Parameter: network-address is missing."
fi
But this if-test doesn't work at all. The exclamation mark is also missing.
Any solutions ?