display previous cmd

how can i program shell to appear previous cmd on the
cmd line when i press up arrow key

thanx yy990605

You don't need to program your shell for that. bash already has this feature and so does ksh. For ksh, type:
ksh -o emacs
and check if your ksh supports this.

the suggestion posted by hell666 is not workin
wot version u r using
mine is sunos 5.6

It is important to know what shell you are using... as the behaviour is different between shells.

For bash shell.....you can use the arrow keys for last command.

For Ksh you just press escape followed by k - to fetch the last command. Press k again for the one before that...etc......

Another useful command with ksh is escape followed by backslash...this will complete the path for you if there is one option only that it could be.....ie.

If you have 3 files in a directory (called a123 b123 and c123) and you type 'cat a' then press escap and backslash it will complete the a123 as it is the only possible option. this also works with directory names and down several layers...

The equivalent in bash for this is tab to complete the name.