Operating System - HP-UX
1751805 Members
5265 Online
108781 Solutions
New Discussion юеВ

Re: command history recall

 
SOLVED
Go to solution
Chris Conrad
Occasional Advisor

command history recall

I am trying to set up command history recall on my HP C3600 Worstations. When I type K to recall the previous command, all I see on the screen is ^[K. What do I need to set up to capture the ?
12 REPLIES 12
Robert-Jan Goossens
Honored Contributor

Re: command history recall

Hi,

add this to your profile

set -o vi
HISTFILE=$HOME/.sh_history
HISTSIZE=100

Robert-Jan.
RAC_1
Honored Contributor

Re: command history recall

recalling history is escape k/j
There is no substitute to HARDWORK
T G Manikandan
Honored Contributor

Re: command history recall

you have to use

#set -o vi
or
#ksh -o vi


THanks
Jose Mosquera
Honored Contributor

Re: command history recall

Hi,

Have you set in your user profile the followings statements?:

EDITOR=vi
export EDITOR

HISTFILE=/.sh_history; export HISTFILE
HISTSIZE=; export HISTSIZE

Where represent the number of commands lines stored in /.sh_history

And the correct way to invoke commands is by [Esc-Key] + K

Rgds
Chris Conrad
Occasional Advisor

Re: command history recall

everything is set up such that .sh_history captures the commands. The problem is..... that when i press the escape key, and then the "K" key, it simply shows up as ^[K instead of the previous command.
I have EDITOR=VI and set -o vi in my profile.
Please help
Robert-Jan Goossens
Honored Contributor

Re: command history recall

Hi,

here is a part of my /root/.profile

--cut----

# Be sure that VUE does not invoke tty commands

if [ ! "$VUE" ]; then

# -- Do trick to set the display in case of remote login
HOST=`who am i -R |awk '{print $NF}' | sed "s/(\(.*\))/\1/"`
if [ "$HOST" != "" ] && [ "$HOST" != ":0" ] && [ "$HOST" != ":0.0" ];
then
if [ "$HOST" = `who am i -R |awk '{print $NF}' | sed "s/(\(.*\))/\1/"` ]
then
HOST=$HOST:0.0
fi
echo " +--<<"
echo " | Remote login detected, setting DISPLAY to $HOST"
echo " +-->>"
DISPLAY=$HOST
export DISPLAY
fi

# Set up the terminal:
if [ "$TERM" = "" ]
then
eval ` tset -s -Q -m ':?hp' `
else
eval ` tset -s -Q `
fi
case `tty` in
*console*) TERM=hp ;;
*) TERM=vt100 ;;
esac
stty erase "^H" kill "^U" intr "^C" eof "^D"
stty hupcl ixon ixoff
tabs

echo
echo "Value of TERM has been set to \"$TERM\". "
export TERM

EDITOR=vi
export EDITOR

fi # if !VUE

---cut----

try it.

Robert-Jan.
Jose Mosquera
Honored Contributor

Re: command history recall

Hi,

Maybe a terminal definition is involved, try setting your TERM=hp or TERM=vt100.

If this work, pls check your current stty assignament and compare it with your original TERM definiton.
#stty -a

Rgds.
John Jayaseelan
Super Advisor

Re: command history recall

Hi,

Trying the following shoud work.

set -o vi

or
EDITOR=vi
export EDITOR

Also set the history file size.

John Jayaseelan
harry d brown jr
Honored Contributor
Solution

Re: command history recall

Chris,

what does this return:

env | grep -i -e edit -e shell -e term -e hist

like this:

# env | grep -i -e edit -e shell -e term -e hist
EDITOR=vi
HISTFILE=/.sh_history
SHELL=/sbin/sh
HISTSIZE=50000
TERM=xterm
#


live free or die
harry
Live Free or Die