Files
bash_utils/valid-ip.sh
root 4c60127786 make local variables local
.. to not interfere with variables in the scripts that source these utils.
2025-02-03 11:12:05 +01:00

12 lines
247 B
Bash

#!/bin/bash
# https://stackoverflow.com/questions/13777387/check-for-ip-validity
function validip () {
local ip=$1
if [ -z $ip ] || ! [[ $ip =~ ^[0-9]+\.[0-9]+\.[0-9]+\.[0-9]+$ ]]; then
return 1
else
return 0
fi
}