Advertisement
freddyncalm

start-wordsjisho.sh

Dec 5th, 2016
233
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 1.19 KB | None | 0 0
  1. #!/bin/bash
  2.  
  3. csearch=""
  4. fhist="$HOME/.jishosearch.txt"
  5. if [ -f $fhist ]; then
  6.     csearch=$(cat $fhist)
  7. fi
  8.  
  9. export DISPLAY=:0
  10.  
  11. action=$(yad --title="Buscapalabras Web" --center --form --button=Goo:0 --button=Jisho:2 --button=Twitter:4 --button=Cancelar:1 --item-separator=, --separator="" --entry --text="Palabras a buscar en jisho.org, goo.ne.jp o Twitter:" --entry-text "$csearch");
  12. ret=$?
  13.  
  14. if [[ $ret -eq 1 ]]; then
  15.         echo "Acción cancelada!!"
  16.         exit 0
  17. fi
  18.  
  19. # Para usar Google Chrome en lugar de Firefox:
  20. # algo=$(google-chrome "http://jisho.org/words/?dict=edict&jap=$action");
  21.  
  22. # Para buscar en el diccionario completo de Goo:
  23. # algo=$(firefox "http://dictionary.goo.ne.jp/freewordsearcher.html?mode=0&x=0&y=0&kind=all&MT=$action");
  24.  
  25. if [[ $ret -eq 0 ]]; then
  26.     echo "$action" > "$fhist"
  27.     algo=$(firefox "http://dictionary.goo.ne.jp/freewordsearcher.html?mode=0&x=0&y=0&kind=thsrs&MT=${action//+/ }");
  28. fi
  29.  
  30. if [[ $ret -eq 2 ]]; then
  31.     echo "$action" > "$fhist"
  32.     algo=$(firefox "http://jisho.org/words/?dict=edict&jap=${action//+/ }");
  33. fi
  34.  
  35. if [[ $ret -eq 4 ]]; then
  36.     echo "$action" > "$fhist"
  37.     algo=$(firefox "http://twitter.com/search/?f=tweets&q=${action//+/ }");
  38. fi
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement