Writing current date / time to file using shell script
1 answer
Use date >> //home/user/Desktop/Scripts/Date Logs/datelog.txt
.
As I tried on my system: -
date > /tmp/date.txt
... And the file contains Wed Apr 5 09:27:37 IST 2017
.
[Edit] There is a difference between → (append to file) and> (Create new file)
Edit: - As suggested by chepner, you can directly redirect the o / p date command to a file with date >> /tmp/date.txt
.
+2
source to share