web.sh 1.0 KB

123456789101112131415161718192021222324252627282930313233343536
  1. #!/usr/bin/dash
  2. #usage: g [engine] word1 word2 ...
  3. default=''
  4. g="https://www.google.com.hk/search?q="
  5. yt="https://www.youtube.com/results?search_query="
  6. m="http://www.merriam-webster.com/dictionary/"
  7. w="http://en.wikipedia.org/wiki/"
  8. wd="https://en.wiktionary.org/wiki/"
  9. b="http://www.bing.com/search?intlF=1&q="
  10. ks="http://www.iciba.com/"
  11. en="http://www.enacademic.com/searchall.php?SWord="
  12. gen="http://gen.lib.rus.ec/search.php?req="
  13. abb="http://audiobookbay.li/?s="
  14. bd="https://www.baidu.com/s?wd="
  15. gb="https://www.gigablast.com/search?q="
  16. yd="http://dict.youdao.com/search?q="
  17. a="http://www.amazon.com/s?url=search-alias%3Daps&field-keywords="
  18. bdic="http://cn.bing.com/dict/search?q="
  19. be="http://www.britannica.com/search?query="
  20. u="http://www.urbandictionary.com/define.php?term="
  21. o="http://en.oxforddictionaries.com/definition/"
  22. eval engine=\$${1:-default} #engine=$(eval echo \${$1})
  23. shift #concate second argument to the last one with +
  24. string=$1
  25. shift
  26. for a in "$@"
  27. do
  28. string+="+$a"
  29. done
  30. echo $engine$string