Tom's Guide | Tom's Hardware | Tom's Games
![]() |
![]() |
![]() |
Hi,
I found this in my .profile as show below:
export HISTSIZE=1000
trap `date "+# %c" | read -s` debug
export HISTFILE=$HOME/.sh_historyCan anyone tell me what is the second line doing?
Thanks.

The trap command works differently depending on what shell you are using, but the debug option to trap is 'execution of any command'. The read command's -s option places the command in the user's HISTFILE. So, IMO, your above command places something like the following date string in the HISTFILE:
# Tue Jun 26 10:28:45 2007

Thanks Nails,
When I do a $SHELL it return me this /sbin/sh. You are right, I found a lot of date string in the .sh_history file, but I check on all the Unix box and all have that command in the .profile, funny thing is only one Unix box have that date string in the .sh_history file, do you know why?
One more question is why some of the Unix box's .sh_history file will be clear when the dtterm is close, but some is not? the .sh_history file keep on growing in some of the Unix box.
Thanks again.

If you are using /sbin/sh, then I'm assuming you are using the Bourne shell (It's not always correct to assume that sh - means Bourne) The Bourne shell doesn't support shell history; Only the moderns shells - ksh, bash, csh - support history.

![]() |
![]() |
![]() |

This post is quite old and has been locked from receiving new replies. Please create a new posting instead.
| Ads by Google |