Consulta operadora
Um script simples que utiliza o site http://www.qualoperadora.net/ para verificar a operadora de um número de celular ou fixo.
Descrição
Um script simples que utiliza o site http://www.qualoperadora.net/ para verificar a operadora de um número de celular ou fixo.
Versões atualizadas deste script
#!/bin/bash
#
# Consulta operadora de um numero de telefone/celular.
# (http://www.qualoperadora.net)
#
# Uso: operadora [numero]
# Ex.: operadora 1934621026
#
# Autor: Mauricio Calligaris
# Versão: 0.01b
#
# ----------------------------------------------------------------------------
#
# DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
# Version 2, December 2004
#
# Copyright (C) 2013 Mauricio Calligaris <mauriciocalligaris@gmail.com>
#
# Everyone is permitted to copy and distribute verbatim or modified
# copies of this license document, and changing it is allowed as long
# as the name is changed.
#
# DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
# TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
#
# 0. You just DO WHAT THE FUCK YOU WANT TO.
#
# This program is free software. It comes without any warranty, to
# the extent permitted by applicable law. You can redistribute it
# and/or modify it under the terms of the Do What The Fuck You Want
# To Public License, Version 2, as published by Sam Hocevar. See
# http://www.wtfpl.net/ for more details.
#
# ----------------------------------------------------------------------------
if ! [[ "$1" =~ ^[0-9]+$ ]] ; then
exec >&2; echo "Digite apenas os numeros"; exit 1
fi
url="http://www.qualoperadora.net"
post="telefone=$1"
result=$(curl -s --data-urlencode $post $url | grep \<title\> |
cut -f2 -d\> | cut -f1 -d\<);
if [[ "$result" == Resu* ]]
then
awk -F '[-:] ' '{print $2, $4, $5}' <<< $result;
else
echo "Numero não encontrado";
fi