Pular para o conteúdo

Tradutor: ept ( English to Portuguese )

Script  para tradução (Ingles/Portugues)  via shell atravez do babylon
=) espero que gostem..
[]'s
dica:
chmod +x ept.sh
mv ept.sh /usr/local/bin

Jean Michel kfreak
Hits: 7.598 Categoria: Shell Script Subcategoria: Miscelânea
  • Download
  • Nova versão
  • Indicar
  • Denunciar

Descrição

Script  para tradução (Ingles/Portugues)  via shell atravez do babylon
=) espero que gostem..
[]'s
dica:
chmod +x ept.sh
mv ept.sh /usr/local/bin

Download ept.sh Enviar nova versão

Esconder código-fonte

#!/bin/bash
# Simple babylon translator of english to portugues_BR for console
# Tradutor baseado no babylon Ingles/Portugues-BR para console
# $Id: app.sh 314274 2004-05-24 21:04:46Z geiseri $
# ept - Copyright (C) 2005 Jean Michel <jean@toptop>
# Agradadecimentos: Carlindo Marcelo

#Configuração
EPTC="NAO"      # Habilita uso do cache de palavras
                # funciona porem com alguns bugs

# GENERAL CACHE FILE -  Arquivo geral de cache
EPTCFILE="/usr/local/share/.eptcache"

function eptbaccess()
{
        # Acesso ao Babylon
        lynx  -dump -nolist "http://info.babylon.com/cgi-bin/info.cgi?word=$word&lang=5&type=hp&layout=combo.html&n=10&list="  > /tmp/.transl
        #
        if [ "`grep 'Sorry' /tmp/.transl`" ]; then
                echo "PALAVRA NÃO ENCONTRADA!"
        else
                 grep "$word" -A 15 /tmp/.transl | grep -v '____' | grep -v '^$' | grep -v 'all translations'
                 grep "$word" -A 15 /tmp/.transl | grep -v '____' | grep -v '^$' | grep -v 'all translations' >> $EPTCFILE
                echo "-" >> $EPTCFILE
                echo ""
        fi
function eptcache()
{
for i in `grep  "$word" -A 8 $EPTCFILE  | grep '' -n | awk '{print $1}'`
        do
                if [ "$(for b in `echo $i| cut -f 2 -d:`; do d=`echo $i| cut -f 2 -d:`; echo $d | cut -f 2 -d: ; done)" = "-" ]; then
                break
                fi
                fn=`echo $i | cut -f 1 -d:`
        done
        grep  "$word" -A $fn $EPTCFILE  | grep -v '-'

        echo ""
}

if [ -z $1 ]; then
        echo "$0 palavra"
        echo -e "ex: $0 kernel\n"
        exit
fi
if [ ! -e $EPTCFILE ]; then
        touch $EPTCFiLE
fi
word=$1

echo -e "Agarde... Pesquisando pela palavra $word\n"
# Acesso Cache
if [ "$EPTC" = "SIM" ]; then
        if [ ! -z "`grep "$word" -A 3 $EPTCFILE`" ]; then
        eptcache
        else
                eptbaccess
        fi
else
        eptbaccess
fi

rm -f /tmp/.transl

Resetar as configurações do KDE plasma para o padrão

Menu secundário

dcamt

Listas em shell

Informações sobre o computador

#1 Comentário enviado por _luks em 04/03/2006 - 12:01h
muito bom ;D
#2 Comentário enviado por kfreak em 07/03/2006 - 23:19h
valeuz =) comentrios e sugestões são bem vindos..
#3 Comentário enviado por tguazzelli em 14/02/2007 - 09:06h
muito legal esse script.

Parabéns.
#4 Comentário enviado por alexsandro.nerdz em 16/05/2007 - 17:59h
script brutal!
vlw
#5 Comentário enviado por alexsandro.nerdz em 16/05/2007 - 18:01h
script brutal
só uma força..
configurar o cache
#touch /usr/local/share/.eptcache
#chmod a+rw /usr/local/share/.eptcache

Contribuir com comentário

Entre na sua conta para comentar.