How to set date time using a file content
I have a file called foo with a date string in it - and nothing else in the file
2010.01.13-22:28:28 I want to send this file content to date -s command so I can modify using a cron job. I tried several ways to pipe the file contents to date command but did not work. Any tips/suggestions will be appreciated. |
Hi, welcome to LQ!
What locale are you in, what's your "normal" date format? Cheers, Tink |
Quote:
|
Well ... it should work just like this then.
Code:
date -s "$(cat foo)" |
On a different note: why on earth would you want to set
time & date from a file via a cron-job? At the end of the day crons behavious depends on the time & date, so it seems very odd to me to have it change those? Cheers, Tink |
All times are GMT -5. The time now is 05:53 AM. |