Open the Linux command line English-Chinese dictionary

Source: Internet
Author: User

Realize:

Step 1: Add the following code in the corresponding environment variable configuration file (no ~/.BASHRC,/etc/profile, etc in these files)
Here we add to the ~/.BASHRC file

# jianbing.org on dnsfunction J {Dig "$*.jianbing.org" +short txt | perl-pe ' s/\\ (\d{1,3})/chr $1/eg; s/(^ "|" $)//g '}

Step 2: Reopen a shell, and at the command line type J + the word that needs to be translated. Such as:

[Email protected] ~]# J cat[kt]n. cat [[email protected] ~]# J Dog[dg]n. Dogs, dogs, dog-like animals, despicable people, villains, villains Vt. Tracking, trailing

Look at the code is also relatively simple, is to write a shell function, After stitching the words or phrases received by the function and jianbing.org, the DNS query is made by dig, the short information is returned, the regular matching substitution is passed to Perl through the pipeline, and finally formatted by the shell of Linux itself.

This article is from the "Static Like Night Wind" blog, please make sure to keep this source http://siliotto.blog.51cto.com/8887165/1598177

Open the Linux command line English-Chinese dictionary

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.