Latín


#!/bin/bash
a=""
function translate () {
if [ $# -lt 2 ] || [ "$1" = "--help" ] || [ "$1" = "-h" ]; then

echo -e "Traduce palabras del latín al inglés."
echo -e "Uso : "
echo -e " $0 opción palabra"
echo -e "Opciones :"
echo -e " s Palabra que comience por"
echo -e " e Palabra que termine por"
echo -e " c Palabra que contenga"
echo -e " x Palabra exacta"
return
fi

if [ "$1" = "s" ]; then
a="start"
fi

if [ "$1" = "e" ]; then
a="end"
fi

if [ "$1" = "c" ]; then
a="substring"
fi

if [ "$1" = "x" ]; then
a="exact"
fi

lynx -dump -nolist "http://www.perseus.tufts.edu/hopper/resolveform?type=$a&lookup=$2&lang=la" | sed ' 1, 21 d'

}
translate $1 $2

No hay comentarios: