HISTSIZE environment variable problem | Unix Linux Forums | UNIX for Advanced & Expert Users

  Go Back    


UNIX for Advanced & Expert Users Expert-to-Expert. Learn advanced UNIX, UNIX commands, Linux, Operating Systems, System Administration, Programming, Shell, Shell Scripts, Solaris, Linux, HP-UX, AIX, OS X, BSD.

HISTSIZE environment variable problem

UNIX for Advanced & Expert Users


Closed Thread    
 
Thread Tools Search this Thread Display Modes
    #1  
Old 01-16-2006
Kenneth2006 Kenneth2006 is offline
Registered User
 
Join Date: Jan 2006
Last Activity: 17 January 2006, 3:20 AM EST
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
HISTSIZE environment variable problem

Hi All,

I am connecting to a sun solaris 5.9 unix (korn shell) server using the x terminal. There is some problem with the HISTORY File where the HISTSIZE env variable is not working. Although the HISTSIZE is set to 20 already but the HISTORY file keep increasing and exceeded the size.
There is another option where I just tail -20 $HISTFILE and put in into a temporary file before mv it to the name $HISTFILE but strangely this will actually just clear off the $HISTFILE when I run the script on the .kshrc file.
This script is working when I test it in command line.

I hope you all can help, thanks

Regards,
Kenneth
Sponsored Links
    #2  
Old 01-16-2006
blowtorch's Avatar
blowtorch blowtorch is offline Forum Advisor  
AFK
 
Join Date: Dec 2004
Last Activity: 28 July 2014, 9:39 AM EDT
Location: UK
Posts: 2,351
Thanks: 0
Thanked 6 Times in 6 Posts
You are cross posting. You have two threads with the same topic. One is here and the other is here. Please do not do this. It is against the rules.
Sponsored Links
    #3  
Old 01-16-2006
Kenneth2006 Kenneth2006 is offline
Registered User
 
Join Date: Jan 2006
Last Activity: 17 January 2006, 3:20 AM EST
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
$histfile

Hi All,

Sorry, actually this is the first time i use this forum and I post it in wrong section. Please help to remove the message in another section.
One thing I want to ask why I notice that the $HISTSIZE actually is to control the size of HISTORY instead of the $HISTFILE in the korn shell. How can I control the size of $HISTFILE

Hope you all can help

Thanks,
Kenneth
    #4  
Old 01-17-2006
Perderabo's Avatar
Perderabo Perderabo is offline Forum Staff  
Unix Daemon (Administrator Emeritus)
 
Join Date: Aug 2001
Last Activity: 20 November 2014, 5:33 PM EST
Location: Ashburn, Virginia
Posts: 9,930
Thanks: 64
Thanked 438 Times in 261 Posts
I have deleted the duplicate thread.

HISTSIZE controls the size of the history list. HISTFILE controls where the history is stored. But they must be set when ksh first does something with the history list. Setting them later has no effect. Exporting them into the environment ensures that they will affect shells spawned later. But that won't stop the rule that each ksh process looks at them once and once during its lifetime. I don't know what "the HISTSIZE is set to 20 already" is supposed to mean. If you set that in the environment prior to invoking ksh, it should work. But most likely you are setting the variable in a startup file (thus after ksh starts to run) and you are setting too it late. Note that ksh writes functions into the history (unless nolog is on). Did you define a function prior to setting HISTSIZE?
Sponsored Links
    #5  
Old 01-17-2006
Kenneth2006 Kenneth2006 is offline
Registered User
 
Join Date: Jan 2006
Last Activity: 17 January 2006, 3:20 AM EST
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
$histsize

I actually write export HISTSIZE=20 in the .kshrc file almost at the end just before the functions definition. If this is wrong, can you teach where to set the variable.
There is a line set -o nolog in the .kshrc just before a series of function definition.

Thanks for you help

regards,
Kenneth
Sponsored Links
    #6  
Old 01-17-2006
Perderabo's Avatar
Perderabo Perderabo is offline Forum Staff  
Unix Daemon (Administrator Emeritus)
 
Join Date: Aug 2001
Last Activity: 20 November 2014, 5:33 PM EST
Location: Ashburn, Virginia
Posts: 9,930
Thanks: 64
Thanked 438 Times in 261 Posts
With a login shell, /etc/profile and then ~/.profile are sourced first. Try setting HISTSIZE as the first thing.
Sponsored Links
Closed Thread

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
problem with setting environment variable harshvardhan360 Shell Programming and Scripting 1 11-23-2011 10:17 AM
Expand an environment variable in sed, when the variable contains a slash Ilja Shell Programming and Scripting 2 11-10-2010 10:58 AM
Debian install maintainer environment variable problem royalibrahim Ubuntu 0 07-20-2010 03:41 AM
set environment variable? smartgupta Solaris 8 09-15-2008 02:01 PM
problem in getting the path of environment variable set in bashrc in my shell script krithika Shell Programming and Scripting 8 05-26-2006 09:19 AM



All times are GMT -4. The time now is 09:09 PM.