[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: stream manipulation with time



Hi, there are several parameters for the date command for example:
[tty15][Dreamland:~]$ date +"%H %M %S"
15 21 09
[tty15][Dreamland:~]$ date +%r
03:21:20 PM
[tty15][Dreamland:~]$
for moe info see the manpage of date.
Is it this, that you were loking fore ? ;-)

grtz Peter Durieux

On Sun, 15 Apr 2001, Sebastiaan wrote:

> Date: Sun, 15 Apr 2001 16:44:42 +0200 (CEST)
> From: Sebastiaan <sebas@sacred-key.org>
> To: debian-user@lists.debian.org
> Subject: stream manipulation with time
> Resent-From: debian-user@lists.debian.org
> 
> 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
> 
> 
> 
> -- 
> To UNSUBSCRIBE, email to debian-user-request@lists.debian.org 
> with a subject of "unsubscribe". Trouble? Contact listmaster@lists.debian.org
> 
> 



Reply to: