Specialty Forums
Security and Virus
General Hardware
CPUs/Overclocking
Networking
Digital Photo/Video
Office Software
PC Gaming
Console Gaming
Programming
Database
Web Development
Digital Home

General Forums
Windows XP
Windows Vista
Windows 95/98
Windows Me
Windows NT
Windows 2000
Win Server 2008
Win Server 2003
Windows 3.1
Linux
PDAs
BeOS
Novell Netware
OpenVMS
Solaris
Disk Op. System
Unix
Mac
OS/2

Drivers
Driver Scan
Driver Forum

Software
Automatic Updates

BIOS Updates

My Computing.Net

Solution Center

Free IT eBook

Howtos

Site Search

Message Find

RSS Feeds

Install Guides

Data Recovery

About

Home
Reply to Message Icon Go to Main Page Icon

What is this line doing

Original Message
Name: vicchai
Date: June 25, 2007 at 23:18:33 Pacific
Subject: What is this line doing
OS: HP-UX
CPU/Ram: nil
Model/Manufacturer: 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.


Report Offensive Message For Removal


Response Number 1
Name: nails
Date: June 26, 2007 at 10:34:19 Pacific
Subject: What is this line doing
Reply: (edit)
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


Report Offensive Follow Up For Removal

Response Number 2
Name: vicchai
Date: June 27, 2007 at 18:58:13 Pacific
Subject: What is this line doing
Reply: (edit)
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.


Report Offensive Follow Up For Removal

Response Number 3
Name: nails
Date: June 28, 2007 at 11:14:36 Pacific
Subject: What is this line doing
Reply: (edit)
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.


Report Offensive Follow Up For Removal




Use following form to reply to current message:

   Name: From My Computing.Net Settings
 E-Mail: From My Computing.Net Settings

Subject: What is this line doing

Comments:

 
  Homepage URL (*): 
Homepage Title (*): 
         Image URL: 
 


Data Recovery Software




XP Installed to G?

exessive internet traffic

ZoneAlarm Question. Blocked Connect

Windows Live Messenger Problem

Delete $Uninstall after SP3 updates


The information on Computing.Net is the opinions of its users. Such opinions may not be accurate and they are to be used at your own risk. Computing.Net cannot verify the validity of the statements made on this site. Computing.Net and Computing.Net, LLC hereby disclaim all responsibility and liability for the content of Computing.Net and its accuracy.
PLEASE READ THE FULL DISCLAIMER AND LEGAL TERMS BY CLICKING HERE

All content ©1996-2007 Computing.Net, LLC