Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- mydict () {
- # Show usage
- if [ $# = 1 ]; then
- if [[ $1 == -h || $1 == "--help" ]]; then
- echo "Usage: add any numbers of words as parameters"
- echo "Or: just run mydict and input any numbers of words"
- echo " It will translate every words to Chinese and pronounce it"
- echo " You need have dict installed"
- return
- fi
- fi
- # If any parameters, translate them and pronounce them first
- for param in $@; do
- echo "-----------------------------------------------------"
- dict $param
- mplayer http://dict.youdao.com/dictvoice\?audio\=$param > /dev/null 2>&1
- return
- done
- # Translate every word user input which separated by spaces
- while true; do
- echo -n ">>>"
- read words
- for word in $(echo $words); do
- echo "-----------------------------------------------------"
- dict $word
- mplayer http://dict.youdao.com/dictvoice\?audio\=$word > /dev/null 2>&1
- done
- done
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement