A variety of command line oriented programs allow you to edit the commands before executing them. While the commands differ, Windows users will recognize the spirit as being that of the MS-DOS command shell. Among these programs are the command line versions of Maple and MATLAB and the UNIX Bash and Korn shells. While some of these allow a choice of command sets, we will discuss the "emacs-like" command sets which are (almost) common among these programs.
The simplest approach to editing is to see which of the keyboard's movement keys are recognized. These keys are:
A given pair of program at the far end and terminal program at your end may or may not support any of these keys. If one of the keys is not recognized (and if you have time to burn) you can check the "preferences" or "configuration" of your terminal program. A simpler solution may be to use the emacs commands listed in the next section.
Although they are by no means as self-explanatory as the use of arrows, the subset of emacs commands are more likely to work with a given terminal program, as well as providing a richer set of functions. Most of these commands are of the form control-letter (written ^letter), where you hold down the control key while typing the letter key. The simplest commands (those which directly replace the keys from the preceding section) are:
The easiest way to copy expressions from one command to another is to use your own computer's clipboard, together with the terminal program's Cut and Paste menu commands. If this is not practical, or if you are in the mood to do everything with a command key, the emacs edit keys include their own cut and paste function.
Some programs keep a history of commands which have been executed. Commands in this buffer can be recalled in a variety of ways. Some programs have special symbols to recall them (!! in UNIX's C Shell, % in Mathematica and Maple).
A simpler approach which is now commonly used is to view them as being written in a file (the history buffer), so that you can go to earlier commands by going "up" in the file with the up arrow key or the "^p" command. Using this approach you can scroll back through earlier commands until you find the one you want, and then edit it to create a new command.