Computing.Net > Forums > Unix > What is this line doing

Computer Problems? Computing.Net has over 1,000,000 posts about all things technology related! Over 90% answered within 24 hours! Click here to start participating now! Also, be sure to check out the New User Guide.

What is this line doing

Reply to Message Icon

Name: vicchai
Date: June 25, 2007 at 23:18:33 Pacific
OS: HP-UX
CPU/Ram: nil
Product: HP
Comment:

Hi,

I found this in my .profile as show below:

export HISTSIZE=1000
trap `date "+# %c" | read -s` debug
export HISTFILE=$HOME/.sh_history

Can anyone tell me what is the second line doing?

Thanks.



Sponsored Link
Ads by Google

Response Number 1
Name: nails
Date: June 26, 2007 at 10:34:19 Pacific
Reply:

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


0

Response Number 2
Name: vicchai
Date: June 27, 2007 at 18:58:13 Pacific
Reply:

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.


0

Response Number 3
Name: nails
Date: June 28, 2007 at 11:14:36 Pacific
Reply:

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.


0

Sponsored Link
Ads by Google
Reply to Message Icon

Related Posts

See More







Post Locked

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


Go to Unix Forum Home


Sponsored links

Ads by Google


Results for: What is this line doing

what is dcop? www.computing.net/answers/unix/what-is-dcop/6264.html

What is www.computing.net/answers/unix/what-is-/1803.html

recursive search of subdirectories www.computing.net/answers/unix/recursive-search-of-subdirectories/6250.html