sd 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  1. #!/bin/sh
  2. # sd: the dictionaries collections manager for StarDict
  3. #
  4. # RUN THE BELOW COMMAND ONCE AS ROOT
  5. #
  6. # chgrp users /usr/share/stardict ; chmod 775 /usr/share/stardict ; exit
  7. #
  8. # RUN THE ABOVE COMMAND ONCE AS ROOT
  9. #
  10. if [ "$1" == "" ]
  11. then
  12. cd /usr/share/stardict/
  13. ls -l | grep '\->' | sed 's/.* dic \->/dic ->/'
  14. ls | grep '^dic\.'
  15. elif [ "$1" == "?" ]
  16. then
  17. cd /usr/share/stardict/
  18. for d in dic.*
  19. do
  20. echo
  21. ls -l | grep $d | sed 's/.* dic/dic/'
  22. ls -1 /usr/share/stardict/$d
  23. done
  24. elif [ "$2" == "?" ]
  25. then
  26. if [ -e /usr/share/stardict/dic.$1 ]
  27. then
  28. ls -1 /usr/share/stardict/dic.$1
  29. else
  30. echo "There is no /usr/share/stardict/dic.$1."
  31. fi
  32. elif [ -e /usr/share/stardict/dic.$1 ]
  33. then
  34. if [ "$(ps ax | grep 'stardict' | grep -v 'grep')" != "" ]
  35. then
  36. killall stardict
  37. fi
  38. cd /usr/share/stardict/
  39. rm dic
  40. ln -s dic.$1 dic
  41. cd
  42. if [ ! -e ~/.stardict/stardict.cfg.$1 ]
  43. then
  44. cp ~/.stardict/stardict.cfg.template ~/.stardict/stardict.cfg.$1
  45. fi
  46. cp ~/.stardict/stardict.cfg.$1 ~/.stardict/stardict.cfg
  47. ls -l /usr/share/stardict/ | grep '\->' | sed 's/.* dic \->/dic ->/'
  48. ls -1 /usr/share/stardict/dic.$1
  49. else
  50. echo "There is no /usr/share/stardict/dic.$1."
  51. fi