1

I have a script which fetches a word's meaning (translates english/turkish and turkish/english) from a remote web page and parsing it with using elinks and simple grep. It's quite simple script, but the strange thing is that it doesn't seem to work on my yakuake, but it's running gently on default gnome terminal or guake.

the script:

#!/bin/bash

url_encode() {
    # http://www.commandlinefu.com/commands/view/4840/url-encode
    # http://stackoverflow.com/questions/296536/urlencode-from-a-bash-script
    echo -n "${@: -1}" | python2 -c "import urllib, sys; print urllib.quote(sys.stdin.readline())"
    # echo "$@" | perl -MURI::Escape -ne 'chomp;print uri_escape($_),"\n"'
}

if [ $1 = "-v" ]; then
  elinks -dump -no-numbering "http://tureng.com/search/$(url_encode $@)" | grep -E '(^\s*Category\s*|>$)' --color=never | less
else 
  elinks -dump -no-numbering "http://tureng.com/search/$(url_encode $@)" | grep -E '(^\s*Category\s*|>$)' --color=never | head -n 6
fi

when I run this on gnome terminal, this is the output;

14:03 ~ $ tureng test
     Category    Turkish  English
   1 General  n. test    trial      >
   2 General  n. test    testing    >
   3 General  n. test    test       >
   4 General  n. test    experiment >
   5 General     test    quiz       >

and this is the yakuake output;

14:04 ~ $ tureng test
   <!-- Web.Config Configuration File -->
   <configuration>
       <system.web>
           <customErrors mode="Off"/>
       </system.web>
   </configuration>

I'm completely lost on this. Any idea on, why this happens would be appreciated.

Muhammet Can
  • 1,304
  • 2
  • 16
  • 30

0 Answers0