[Top][All Lists]

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

Re: touch - cannot use options "backward"

From: Bob Proulx
Subject: Re: touch - cannot use options "backward"
Date: Mon, 1 Nov 2004 23:35:25 -0700
User-agent: Mutt/1.5.6+20040907i

Laurent Charpentier wrote:
> Apparently the "touch" command has a --backward option to
> modify the time of a file by a number of seconds.
> http://www.linuxforum.com/man/touch.1.php

If I had to guess I would say that is a patched version of coreutils.

> However, I tried several version of touch (coreutils): 4.5.3, 4.5.8,
> 5.0, 5.2.1 and this option is not available.
> How can I get this option?

You would need to find out where those man pages came from.  But
fortunately I don't think you need it.  Just use 'date'.

> Or is there another program to change the time stamp of a file
> (like 1 hour backward).

Using a combination of GNU 'date' and GNU 'touch' this is easy.

  touch --date "$(date --date '1 hour ago')" /tmp/foo

If I were scripting that I think I would prefer using the -R and -u
options too.

  touch -d "$(date -R -u -d '1 hour ago')" /tmp/foo
  touch --date="$(date --rfc-2822 --utc --date='1 hour ago')" /tmp/foo


reply via email to

[Prev in Thread] Current Thread [Next in Thread]