ReadLine () library installation and use, implementation of command completion

Source: Internet
Author: User

Before the implementation of a simple shell, want to implement the command line auto-completion function, and then surf the Internet to check the data, found that most of them mentioned

ReadLine () library, after the Aberdeen understanding, found that the bottom of the bash implementation is also called the Library, my system is Fedora 21 does not install this library, and the man page does not have relevant information, (Q:bash call who? No matter how much, the first no brain to turn it, the side of the turn around to see the situation (I was miserable ... )

First flat intuition yum install ReadLine

But this information is available:

Tip I ReadLine package has been installed .... But there's no <readline.h> this library under/usr/include, okay? And then went to check the information,

Found the need to install libreadline But because of the version of the problem and toss a half day.

Redhat Series under this package is called Readline-devel Ubuntu Readline-dev Subdivision is divided into Libreadline5-dev and Libreadline6-dev

The installation of Yum install Readline-devel succeeded

Under the/usr/include already has the <readline>

Start referencing header file

Already quoted OK, start compiling it, can't wait to ...

It has taken a day and a half to press this library.


What the hell is this, is there a problem with makefile? Hurry up, makefile\.

I have linked readline this????????????????????????????????????????????????????

So we started to check the data and found this.

ldconfig-p | grep readline

This is a library file so you need to check to see if there is a library, if it is a dynamic library then you need to add this dynamic library when linking.

Found that this is a dynamic library (unfortunately I guess)


And then just add this library OK

then make OK!

My My_shell already has auto-complete function.

Copyright NOTICE: This article for Bo Master original article, without Bo Master permission not reproduced.

ReadLine () library installation and use, implementation of command completion

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.