Advertisement
constantin-net

words_test_v1

Feb 17th, 2020
214
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 2.55 KB | None | 0 0
  1. #words
  2. #!/bin/bash
  3. #declare -a arr=(`echo $1 | tr -d "\"" | tr -s " ",",","!","?",".","-","—" "\n"`)
  4. declare -a arr=(`cat /tmp/sub`)
  5. result=""
  6. count_arr=${#arr[@]}
  7. for ((i=0; i<count_arr; i++)) do
  8. result+="\n${arr[$i]}\t`sdcv -n -u dictd_www.mova.org_sokrat_enru ${arr[$i]} | head -n6 | tail -n1`"
  9. done
  10. command=`cat <<EOF
  11. local naughty = require("naughty")
  12. naughty.notify({ position = "top_right", title = "$1", text = "${result}" })
  13. EOF
  14. `
  15. echo "${command}" | awesome-client
  16. exit 0
  17.  
  18. #words2
  19. #!/bin/bash
  20. declare -a arr=(`cat /tmp/sub`)
  21. result=""
  22. toresult=""
  23. count_arr=${#arr[@]}
  24. lstr=0
  25. lstr_n=0
  26. lwidth=70
  27.  
  28. for ((i=0; i<count_arr; i++)) do
  29. #  if [ ${arr[$i]} == "a" ] || [ ${arr[$i]} == "A" ] || [ ${arr[$i]} == "an" ] || [ ${arr[$i]} == "An" ] || [ ${arr[$i]} == "and" ] || [ ${arr[$i]} == "And" ] || [ ${arr[$i]} == "the" ] || [ ${arr[$i]} == "The" ] || [ ${arr[$i]} == "and" ] || [ ${arr[$i]} == "And" ] || [ ${arr[$i]} == "of" ] || [ ${arr[$i]} == "Of" ] || [ ${arr[$i]} == "should" ] || [ ${arr[$i]} == "Should" ] || [ ${arr[$i]} == "on" ] || [ ${arr[$i]} == "On" ] || [ ${arr[$i]} == "I'm" ] || [ ${arr[$i]} == "Do" ] || [ ${arr[$i]} == "do" ] || [ ${arr[$i]} == "It" ] || [ ${arr[$i]} == "it" ];
  30. #    then arr[$i]=""
  31. #  fi
  32.   case ${arr[$i]} in
  33.     [Aa]|[Aa]"re"|[Aa]m|[Ww]"e've"|[Ww]"hat's"|[Bb]"een"|[Cc]"an't"|[Tt]"hey're"|"I've"|[Ss]"he's"|[Dd]"oes"|"I'd"|[Ww]"on't"|[Aa]"n"|[Aa]"nd"|[Tt]"he"|[Oo]"f"|[Oo]"n"|[Ss]"hould"|[Ww]"ould"|"I'm"|[Ii]"t"|[Dd]"o"|[Uu]"s"|[Aa]"s"|[Cc]"an"|[Ww]"e"|[Yy]"ou"|[Dd]"idn't"|[Dd]"on't"|[Ww]"eren't"|[Gg]"otta"|"'em"|[Gg]"onna"|[Oo]"h"|[Mm]"an"|[Hh]"uh"|"I'll")
  34.       arr[$i]=""
  35.       ;;
  36.     *)
  37.       ;;
  38.   esac
  39.   toresult="` sdcv -n -u quick_english-russian ${arr[$i]} | head -n5 | tail -n1 ` "
  40.   if [[ ${toresult} == *Ничего* ]] ;
  41.     then toresult="_ "
  42.   fi
  43. #  result+="` sdcv -n -u quick_english-russian ${arr[$i]} | head -n5 | tail -n1 ` "
  44.   result+=${toresult}
  45.   lstr=${#result}
  46.   if [[ $lstr -gt $lstr_n+$lwidth ]] ; then
  47.     result+="\n"
  48.     lstr_n=($lstr_n+$lwidth)
  49.   fi
  50. done
  51. command=`cat <<EOF
  52. local naughty = require("naughty")
  53. naughty.notify({ position = "bottom_middle", text = "${result}" })
  54. EOF
  55. `
  56. echo "${command}" | awesome-client
  57. exit 0
  58.  
  59. #words3
  60. #!/bin/bash
  61. googled=`links2 -http.fake-user-agent Mozilla/4.0 -dump https://translate.google.com/translate_a/t?client=p\&text=\`cat /tmp/sub | tr '\n' '+'\`\&sl=en\&tl=ru`
  62. command=`cat <<EOF
  63. local naughty = require("naughty")
  64. naughty.notify({ position = "bottom_middle", text = ${googled} })
  65. EOF
  66. `
  67. echo $command | awesome-client
  68. exit 0
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement