stream manipulation with time
Hi,
I have two computers and I want to set the time on computer 1 the time of
computer 2 minus 1 (I need this because I run root over nfs, and I do
not like 'modification in future' warnings). I played along with some
commands and it seems that something almost works (and when it works,
'date' will be replaced by a 'rdate' syntax):
date | cut -c12-14 prints the hours
expr `date | cut -c15-16` - 1 takes the minutes minus 1 and prints it too
date | cut -c17-19 prints the seconds
What would be nice if these three could be put on one line, like:
date --set `date | cut -c12-14``expr `date | cut -c15-16` - 1``date | cut -c17-19`
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
The problem is the nested `` here:
Is there someway to bypass this, or a better method to do this so I only
have to call 'date' once?
Of course I could write a script, echo the three expressions to a file and
do a: date --set `cat /tmp/time`
but I like more elegant methods.
Thanks in advance,
Sebastiaan
Reply to: