Show last command with up arrow on a linux c shell

Posted by nunos on Stack Overflow See other posts from Stack Overflow or by nunos
Published on 2010-04-15T23:48:35Z Indexed on 2010/04/15 23:53 UTC
Read the original article Hit count: 293

I have implemented a simple linux shell in c. Now, I am adding some features and one I immediately thought about was to be able to show the last commands with the up arrow.

Question 1:
However, I have no idea how to accomplish this. Do you?

Question 2:
Any comment on how to store the "history" commands are also appreciated. I suppose something like a queue which allows access to all elements would be a good idea. Am I wrong? Do I have to implement it or is there already some good implementation out there I should know about?

Thanks.

© Stack Overflow or respective owner

Related posts about linux

Related posts about shell