#!/bin/bash #################################################### #Visite o meu blog: http://ubuntued.blogspot.com/ # #################################################### nome=$( zenity --entry --text="URL:" --title="Apple Trailers") temp=$(echo $nome | grep "/hd/") if [[ $temp = "" ]] then nome=$(echo $nome"hd/") fi if [[ $nome != "" ]] then wget $nome -O ficheiro.html accao=$(cat ficheiro.html | grep 720 | awk -F"','" '{ print $10 }'| awk -F"720" '{ print "wget " $1 "h720" $2 }') rm ficheiro.html accao=$(echo $accao | awk -F"/" '{ print $NF }') existe=$(ls | grep "$accao") if [[ $existe = $accao ]] then zenity --question --text="Você já tem este trailer: \n \t (Nome do ficheiro: $existe ).\n Continuar na mesma?" || exit fi $accao | sh existe=$(ls | grep "$accao") if [[ $existe = $accao ]] then zenity --info --text="Sucesso, o ficheiro foi guardado com o nome $existe" else zenity --error --text="Ocorreu algum erro. Possiveis problemas: Já tinha este ficheiro ou não foi possivel fazer download." fi fi