Implementation of built-in qcd in Ubuntu12.04

Source: Internet
Author: User
Originally, the qcd program couldn't run on Ubuntu, so I finally realized it. I hereby declare that I should make appropriate modifications on the basis of the qcd program. Original qcd code download link: free download link on http://linux.linuxidc.com/user name and password is the official website of www.linuxidc.com//tu/tututu/ tuqqqcd

Originally, the qcd program couldn't run on Ubuntu, so I finally realized it. I hereby declare that I should make appropriate modifications on the basis of the qcd program.

Source qcd code download link:

Free onHttp://linux.linuxidc.com/

Both the user name and password areWww.linuxidc.com

The specific download directory is in/October 12.04/October 7/October 7/cn-embedded qcd implementation on Ubuntu

Download Method see http://www.linuxidc.com/Linux/2013-07/87684.htm

Directly install cannot run. First, I changed bin_content =/usr/local/sbin In the install file to bin_content =/usr/local/bin, and then deleted qcd. sh.

Then we changed the 130 rows in the qcd code.

Echo $ enter_dir>/tmp/qcd_temp

Exit 0

The idea is to save the obtained path to the qcd_temp file. I originally wanted to change the path to cd directly in the shell program, but found that it was not feasible. I can only export the path in a roundabout way, and then use an alias to get an alias.

Alias cdd = 'cdd () {>/tmp/qcd_temp; qcd; if [$? -Eq 0]; then cd 'cat/tmp/qcd_temp '; fi ;}; cdd'

To make it take effect permanently, copy it to the/root/. bash_alias file.

It is hard to understand this sentence. First, clear the qcd_temp file, execute qcd, enter a number, and then export the path to the qcd_temp file, then, determine whether the returned value of the previous command is 0 (if the path can be exported, 0 is returned, and 1 is returned for other commands). Then, the path switching is achieved by cd, it was easy to write. After a long time, I finally got it done, so I recorded it.

The final implementation is to use the qcd-s path to save the path, and then use cdd to jump, which saves a lot of time to switch the path.

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.