Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ip=$1
- # guardamos IFS original
- ifs_bak=$IFS
- # Declaramos un nuevo IFS
- IFS=.
- # almacenamaos cada campo en un array
- octeto=($ip)
- # reestablecemos el IFS
- IFS=$ifs_bak
- contador=0
- if [ ${#octeto[@]} -eq 4 ];then
- for i in ${octeto[@]};do
- echo $i
- done
- else
- echo "No es una ip valida"
- fi
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement