Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.sys.mac.misc > #379

Re: touch for you BSD gurus

From Robert Peirce <bob@peirce-family.com>
Newsgroups comp.sys.mac.misc
Subject Re: touch for you BSD gurus
Date 2011-06-13 07:57 -0400
Organization My Mac Laptop
Message-ID <bob-A36DFD.07572913062011@5ad64b5e.bb.sky.com> (permalink)
References <bob-F0B857.12544012062011@5ad64b5e.bb.sky.com> <nospam.News.Bob-F405BF.20261212062011@news.eternal-september.org>

Show all headers | View raw


In article 
<nospam.News.Bob-F405BF.20261212062011@news.eternal-september.org>,
 Bob Harris <nospam.News.Bob@remove.Smith-Harris.us> wrote:

> You can do this with a little script
> 
> #!/usr/bin/env bash
> typeset delta="$1"
> shift
> touch -t $(date -v ${delta} +%Y%m%d%H%M.%S) "$@"
> 
> Now give the file a name (mytouch) and make it executable
> (chmod +x mytouch).

I'm doing something like that.

I=`date -v+9m -v-1y "+%y%m%d"`
touch -t ${I}2359 TS

I was hoping there might be an arg I could give directly to touch.

I had to add 9 mos and subtract 1 year to have it handle year end 
properly.  For example, trying to go 3 months back from 2/11 resulted in 
11/11 instead of 11/10.

Back to comp.sys.mac.misc | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

touch for you BSD gurus Robert Peirce <bob@peirce-family.com> - 2011-06-12 12:54 -0400
  Re: touch for you BSD gurus Bob Harris <nospam.News.Bob@remove.Smith-Harris.us> - 2011-06-12 20:26 -0400
    Re: touch for you BSD gurus Robert Peirce <bob@peirce-family.com> - 2011-06-13 07:57 -0400
      Re: touch for you BSD gurus Bob Harris <nospam.News.Bob@remove.Smith-Harris.us> - 2011-06-13 21:57 -0400
        Re: touch for you BSD gurus Robert Peirce <bob@peirce-family.com> - 2011-06-14 22:00 -0400

csiph-web