Skip to content

Instantly share code, notes, and snippets.

@themakunga
Created October 24, 2017 13:32
Show Gist options
  • Save themakunga/bc7f793cb7242185236036e06b457f42 to your computer and use it in GitHub Desktop.
Save themakunga/bc7f793cb7242185236036e06b457f42 to your computer and use it in GitHub Desktop.
#!/bin/bash
megadl=/usr/local/bin/megadl
list=$1
clear
if [ ! -f $megadl ];then
echo -e "error!: no se encuentra instalacion de megadl\nFavor bajar desde https://github.com/megous/megatools"
exit 2
fi
if [ ! -f $list ];then
echo -e "error!: no se ha designado archivo con lista, favor incluir"
exit 2
fi
clear
merro='509'
baja(){
local link=$1
ret=$((${megadl} $link)2>&1)
}
espera(){
x=0
while [[ $x -lt 300 ]]; do
clear
echo espere $x segundos
done
}
while read -r line
do
baja $line
if $(echo "$ret" | grep -q -i "$merro"); then
echo "espera"
espera
else
echo "ok"
fi
ret=""
done < $list
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment