|

楼主 |
发表于 2007-12-30 22:36:22
|
显示全部楼层
thanks!
I just want to backup the history cmd to a file,so I added some lines in the /root/.bashrc as:
1 export HISTTIMEFORMAT="%F %T: "
2
3 . ./history.sh
And the history.sh:
1 #!/bin/bash
2 line=$(history | wc -l)
3 if [ $line -le 900 ];then #Here using "-le" just to have a test
4 echo >>/home/backup/history/history3
5 echo " $(date)" >> /home/backup/history/history3
6 history >> /home/backup/history/history3
7 #history -c
8 fi
But when I build a new bash,the /home/hackup/history/history3 only contains the date,no history cmd...
However,directly running the history.sh as . ./history.sh in the /root just get it...
Please tell me why.
Thank you. |
|