Hello, I have a question regarding terminal apps.,
I usually use gnome-terminal but it's missing one very important function. When I run a program that asks for the user's input (for instance: cin >> something; in c++) I can't cycle through the command history with the point keys. This function is provided in DOS on the windows command prompt but not in any of linux terminals that I have seen. I was wondering if anyone knows of any terminal apps that has this function provided. It would be incredibly helpful.
Its not the feature you get in DOS (May be a bug), as far as I know for "cin"
When you press "Point keys" it should grab the ASCII value of Pointer key.
(i.e ^[[A ^[[B ^[[C and ^[[D )
I think that's the correct behavior.
See, that's just what I mean: In gnome-terminal, or konsole, when I press the up or down pointER keys it types out the ASCII codes (eg ^[[A,^[[B,etc). On my windows XP pro workstation, in a DOS command prompt when you hit either the up or down pointer key, it cycles through the previous commands that were typed in to that program since it was last compiled (If you don't believe me try it out). That feature in DOS would be very convenient in linux, especial when you need to type in long file path names.
Know of any linux terminal apps that have this feature?
What shell are you running? The bash shell has this (up/down arrows to cycle thru the command history) as well as filename completion. Check your user entry in /etc/passwd, which is the shell you get when you login. If it isn't bash, then you won't get this capability.
I guess this would be more of a shell question than a terminal app question.
bash does allow you to cycle through the command history stack, but not within a program. DOS allows for this.
$ echo $0
$ ps -p $$
PID TTY TIME CMD
6785 pts/3 00:00:00 bash
True. In the Linux/Unix world, this would be a function of the application. I agree that it would be convenient, but... In any case, this is a good example of how thoroughly the Windows OS is in control of your applications. IMO, this is not necessarily a good thing. It is also one of the reasons why Windows security vulnerabilities are so deadly to applications that otherwise would be secure themselves.
Originally Posted by Alphonse23
Its nothing to do with the shell because when you execute the program..
you are in new non-login shell made by your compiler. noting to do with terminal.
program and teminal both are working fine in this case.
So its the compiler that has this feature...
On windows I use mingw to compile c++ files. I tried downloading mingw32 on fedora10 to see if a compiled program would remember the command history, but It doesn't work. Pressing the pointer keys still results in the ASCII codes.
Does mingw only provide this feature for the windows version. Or am I missing something.
compiling on different platforms is whole different thing, even if you use same compiler.
It's not a compiler thing. It's a device-driver, OS thing. In Windows, the kernel interprets an up-arrow key press in such a way as to present the previous input line to the applications input buffer. Other operating systems could do this, but don't. This would be more difficult in Linux since the X-server does all the keyboard input processing before passing it to the application. So, there is a layer between the OS and the application when you are running a GUI. Even if this input-line recall was supported in the text interface (I don't know for sure), the standard system libraries would have to be modified to support the feature.
Originally Posted by Alphonse23