|
|||||||
| Forums | Search Forums | Register | Forum Rules | Man Pages | Albums | FAQ | Members | Calendar | Search | Today's Posts | Mark Forums Read |
| 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. |
|
|
|
Thread Tools | Search this Thread | Display Modes |
|
#1
|
|||
|
|||
|
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 | ||
|
|
#3
|
|||
|
|||
|
$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
|
||||
|
||||
|
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
|
|||
|
|||
|
$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
|
||||
|
||||
|
With a login shell, /etc/profile and then ~/.profile are sourced first. Try setting HISTSIZE as the first thing.
|
| Sponsored Links | ||
|
![]() |
| Thread Tools | Search this Thread |
| 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 09:17 AM |
| Expand an environment variable in sed, when the variable contains a slash | Ilja | Shell Programming and Scripting | 2 | 11-10-2010 09:58 AM |
| Debian install maintainer environment variable problem | royalibrahim | Ubuntu | 0 | 07-20-2010 02:41 AM |
| set environment variable? | smartgupta | Solaris | 8 | 09-15-2008 01: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 08:19 AM |
|
|