Operating System - HP-UX
1753844 Members
7700 Online
108806 Solutions
New Discussion юеВ

Getting previous commands using up arrow.

 
Siva Prasad
Occasional Advisor

Getting previous commands using up arrow.

I have installed bash shell 3.00 version on my HPUX 11.11 PA-RISC machine. Bash shell is working fine. But if i type the up arrow i am not getting the previous commands. How do i make my bash shell user friendly ( as we find it in Linux like up arrow, backspace and delete keys etc) in hpux. Do i need to configure some thing? Please let me know.
8 REPLIES 8
D Block 2
Respected Contributor

Re: Getting previous commands using up arrow.

Siva,

yes, Linux, is OK, with the the up-arrow,but historical shell is the following:
on hp-ux:
enter 'ksh' commad-line, for example


$ ksh
set -o vi



where key equals like-the up-arrow, next
type the '-' command is like the up-arrow in bash.

try this:

lx
s




what happens?
Golf is a Good Walk Spoiled, Mark Twain.
Mel Burslan
Honored Contributor

Re: Getting previous commands using up arrow.

You definitely need to set something. In linux flavors, this setting comes enabled as default but I think on HPUX this is not the case.

I can not help you much as I am a vi monger and prefer to use esc-k/j/i/l for my command line editing but you can look it up under EMACS style command line editing. I am sure googling some combination of the terms I have given above, willlead you to the correct answer but, you can start your adventure by running this command

set -o emacs

if emacs is properly configured, it might be the solution you are looking for.
________________________________
UNIX because I majored in cryptology...
jayachandran.g
Regular Advisor

Re: Getting previous commands using up arrow.

Hi Shiv Prasad


Check for this environment settings

echo $HISTFILE
answer may be any file name default is .bash_history

cat the file name and see wheather u r able to see any previos commands. If the file is not thr touch that file.

echo $HISTFILESIZE r $HISTSIZE

if the above file is there and there is no entires in it that may a problem with history file size so check this entry it can any thing away from 0.

Jayachandran.G
Muthukumar_5
Honored Contributor

Re: Getting previous commands using up arrow.

You can try as,

set -o emacs
export HISTSIZE=1000
export $HISTFILE=$HOME/.sh_history

put this in /etc/profile to get effect at every login.

hth.
Easy to suggest when don't know about the problem!
Terry Kirk
Advisor

Re: Getting previous commands using up arrow.

Hi;

We're using HP-UX 11.23 on Itanium and the default Posix shell, so I'm not sure if this will work for you.

I defined VISUAL to be emacs and then set up the aliases in the user's .profile:
alias -x __A=`echo "\0020"` #Up arrow ^P
alias -x __B=`echo "\0016"` #Down arrow ^N
alias -x __C=`echo "\0006"` #Right arrow ^F
alias -x __D=`echo "\0002"` #Left arrows ^B

There are two (2) underscores in each alias name.

We use KEAterm which emulates a VT420 and CDE's terminal program which is a dtterm. It seems to work for both.

Idea came from this thread: http://forums1.itrc.hp.com/service/forums/questionanswer.do?threadId=3617

Terry
Terry
OldSchool
Honored Contributor

Re: Getting previous commands using up arrow.

you can configure the .bashrc (?) file to include the commands "set -o vi" or "set -o emacs" and also the arrow key functions.

i usually use o'reilly's book on the bash shell for reference, btw
Rick Garland
Honored Contributor

Re: Getting previous commands using up arrow.

If you set your login shell to bash you will have this capability.

You can get bash from gatekeep.cs.utah.edu in depot format or is source form.

Set your login shell to bash and you will have that up arrow functionality.

Geoff Wild
Honored Contributor

Re: Getting previous commands using up arrow.

bash is initially in emacs mode. Key binding is builtin into the binary. You can switch to vi mode with set -o vi and use the arrow keys in addition to the powerful vi commands.

Rgds...Geoff
Proverbs 3:5,6 Trust in the Lord with all your heart and lean not on your own understanding; in all your ways acknowledge him, and he will make all your paths straight.