[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [lmi] Odd behavior with zsh
From: |
Greg Chicares |
Subject: |
Re: [lmi] Odd behavior with zsh |
Date: |
Thu, 17 Dec 2015 01:00:18 +0000 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Icedove/31.3.0 |
On 2015-12-16 17:02, Greg Chicares wrote:
[...]
> /lmi/src/lmi[0]$<gwc/develop1.txt sed -e'/Id:/!d'
> for z in * ; do grep --quiet --files-with-matches '$Id:' $z && touch
> "--date=$(<$z sed -e'/$Id:/!d' |sed -e's/^.* [0-9][0-9]* \([0-9]\{4\}[-0-9:
> ]*\).*$/\1/')" $z && date -u +'%Y%m%dT%H%MZ' -r $z; done;
> for z in * ; do grep --quiet --files-with-matches '$Id:' $z && touch
> "--date=$(<$z sed -e'/$Id:/!d' |sed -e's/^.*\([0-9]\{4\}[0-9\/: ]*\)
> .*$/\1/')" $z && date -u +'%Y%m%dT%H%MZ' -r $z; done;
> /lmi/src/lmi[0]$
>
> What am I missing?
The Epimenides paradox.
"Epimenides was a Cretan who made one immortal statement:
'All Cretans are liars.'"
-- Hofstadter, _Gödel, Escher, Bach_
It's a self-reproducing command that regenerates itself when a
certain portion is deleted.
The "for z in * ..." line is both:
(1) the command I had typed earlier, and
(2) the result of the simple command above.
I thought zsh was printing it for reason (1), which astonished me.
It was reminiscent of the way zsh's 'time' command echoes back the
command that it's timing.
However, zsh was printing it for reason (2).
It's a matter of self-reference. I wrote a command that extracts
dates from VCS timestamps. I placed a copy of that command in
the file above. That file has no VCS timestamp. Applying that
command to that file causes it to find...that command in that
file. Therefore, reissuing that command from history after
deleting part of it...appears to ignore the deletion.