4

I'm using ksh on unix and connect through putty.

My .sh_history stores all history commands but when I press up arrow nothing comes, please help me.

Praveen
  • 41
  • 1
  • 3

3 Answers3

2

It happened to me, when I'd press any arrow key some strange characters would come when i connect to a remote machine using putty. I don't know why it happened but the remedy is, you have to type the following in the command line.

$ stty -erase backspace enter

i dont remember what is the prompt of ksh($ or #)

EDIT: i found this link,hope this helps:

Make Arrow and delete keys work in Korn shell Command line

A. K.
  • 605
  • 1
  • 5
  • 9
  • when i try stty -erase backspace enter, it says erase not a valid option for stty –  Jun 29 '11 at 11:20
  • try stty erase bskp enter –  Jun 29 '11 at 11:33
  • no luck dude. but it made my backspace key not wrking –  Jun 29 '11 at 11:39
  • wait lemme try now... it's been a while so, a few combinations coming to my mind... i'll get back to you –  Jun 29 '11 at 11:47
  • stty erase ctrl+v bksp enter.... ctrl+v then backspace will show ^H on the terminal then press enter –  Jun 29 '11 at 11:55
  • aditya no luck on these commands too. when i checked my home dir i have only couple of files like .profile and .sh_history and one more. but tere is no .kshrc or .chsrc. will this give u any idea. its a unix machine and am granted access just now –  Jun 29 '11 at 12:17
0

set -o emacs should do the trick. The default config doesn't set the editing mode.

  • i tried set -o emacs but no luck its still the same. nothing comes when i press up arrow –  Jun 29 '11 at 11:19
  • HISTFILE and HISTSIZE are set in the shell? and it's keeping the contents as you type? You've checked that the Terminal->Keyboard settings for the function keys are 'ESC[n~' and what is the ksh version? – Anya Shenanigans Jun 29 '11 at 12:09
  • my version is M-11/16/88f. HISTFILE and HISTSIZE are set. HISTSIZE is 1024 and HISTFILE is /home/user/.sh_history. also the recalling of commands using escape and k is wrking. i would like to change it to up arrow like c shell. kindly help me –  Jun 29 '11 at 13:07
0

Pretty sure the up arrow is a function of bash rather than history (ie: if you have history enabled in ksh or csh it won't work..)

You can either type "bash" once you connect or change the default shell of that user to /bin/bash

Duane
  • 186
  • 3