1833867 Members
2023 Online
110063 Solutions
New Discussion

Re: .sh_history question

 
SOLVED
Go to solution
Chris Conrad
Occasional Advisor

.sh_history question

OK, my account has command history (ie. I can recall previous commands using k, but I do not have an environmental variable called HISTFILE. The system is using my Home/.sh_history file to store the commands. Where is this getting set up? I've searched /etc/profile, and home/.profile and it doesn't get set up in either place.
HELP!
10 REPLIES 10
Marco Santerre
Honored Contributor

Re: .sh_history question

If you do not have this environment variable set in one of your profiles, it automatically defaults to $HOME/.sh_history. If you want to change it, you'll have to define it in one of your profiles .
Cooperation is doing with a smile what you have to do anyhow.
Jose Mosquera
Honored Contributor

Re: .sh_history question

Hi,

In your $HOME/.profile set:

EDITOR=vi
export EDITOR

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


Rgds.
John Palmer
Honored Contributor
Solution

Re: .sh_history question

Hi,

You don't need HISTFILE (unless you are root). The default is to use $HOME/.sh_history (see man sh-posix).

If you want to set HISTFILE to a different value, do it in your .profile.

Regards,
John
Helen French
Honored Contributor

Re: .sh_history question

This is normally set up on the profile file (local). If you don't have one specified, then you can add it the $HOME/.profile file:
HISTSIZE=4096
HISTFILE=/.sh_history

The default is in $HOME directory.
Life is a promise, fulfill it!
Chris Conrad
Occasional Advisor

Re: .sh_history question

OK, I'll buy that. But what might cause , k to not work on some of my systems?
Marco Santerre
Honored Contributor

Re: .sh_history question

add

set -o vi

in your .profile where your k doesn't work
Cooperation is doing with a smile what you have to do anyhow.
Helen French
Honored Contributor

Re: .sh_history question

Once you setup the HISTFILE on profile file, you will be able to use the Esc+k function. For temp. purpose, use this:
# ksh -o vi
Life is a promise, fulfill it!
Chris Conrad
Occasional Advisor

Re: .sh_history question

Thanks! I'll check that out.
John Palmer
Honored Contributor

Re: .sh_history question

Command history should always work for non-root accounts.

For root however, HP insist that HISTFILE is defined. This wasn't always the case and came in either at 10.20 or 11.00 so an older version would work.

Just put:
export HISTFILE=

in root's .profile and it should work OK.

Regards,
John
John Palmer
Honored Contributor

Re: .sh_history question

Looks like HISTFILE for root became mandatory in one of the 10. releases.

Have a look at /usr/share/doc/10.xRelNotes

Regards,
John