1833852 Members
1944 Online
110063 Solutions
New Discussion

history file

 
SOLVED
Go to solution
jerry1
Super Advisor

history file

I am trying to put the "date" in the history
file during login of root.
The problem is that date>>~/.history is not
an interactive command but stdout to the file.
When you try to scroll back thru the history file you get the date string plus the first
command you typed. In this case the command ls:

Tue Jul 20 10:42:15 CDT 2004^Jls


Does anyone know how to put a CR after putting
the date in the history file?
4 REPLIES 4
RAC_1
Honored Contributor

Re: history file

echo "`date` \n" >> ./.history_file

Anil
There is no substitute to HARDWORK
curt larson_1
Honored Contributor
Solution

Re: history file

did you try:
print -s $(date)

The -s option causes the arguments to be written onto the history file instead of standard output
jerry1
Super Advisor

Re: history file

Thanks curt. works.
RAC, I already tried \n but thanks anyway.
Leon Allen
Regular Advisor

Re: history file

What a great little tip - thanks folks!
Time's fun when your having flys (ancient frog saying)