I've got a bash / shell script that has to validate an input whether it's an IP address or not. So far my code works as follows:
Expand|Select|Wrap|Line Numbers
- MYCHECK=` echo ${IPADDR:0:15} | sed "s/[0-9]\{1,3\}//g" `
- ## check if parameter was ip
- #
- if [ ${MYCHECK} = "..." ]; then
- ..
- else
- ..
- fi
Now, my question is: did I miss something? Is it possible to get around this check? (Has been easy to write, so there must be something wrong...)
Regards, Bernd