But i have a query. When i just echo $HISTSIZE in commandline ,i get a value 1000. But when i does it by enabling history in shell script, i get a value 500. Why there is a difference in two values?
– FortuneCookieDec 17 '17 at 10:05

You get different values because, when the shell runs a script, it doesn’t process your startup scripts (.profile, .bashrc etc.). Thus HISTSIZE is set to the default value, 500, rather than the value your startup scripts set, 1000.
– Stephen KittDec 17 '17 at 10:32