OT: cat and tail

Brandon Allbery allbery at kf8nh.com
Sat Dec 19 00:37:06 PST 2009


On Dec 19, 2009, at 03:31 , Scott Haneda wrote:
> On Dec 18, 2009, at 8:08 PM, Brandon Allbery wrote:
>
>> On Dec 18, 2009, at 23:02 , Scott Haneda wrote:
>>> # make a copy of the file and also clear it cd /path/to/ cat  
>>> running_log > stale_log && echo "" > running_log
>>
>>
>> mv running_log running_log.old && touch running_log && cat  
>> running_log.old >stale.log
>
> Mind breaking that out for me?
> If running_log is basically a live copy of another log, always being  
> written to, and a mv (rename) it, I assume that running_log.old  
> still gets written to? The OS keeps writing my tail command to it,  
> even though the name has changed?

Hm.  Think I got confused; the above is intended for the initial  
program's log, not your running log.  (I would think your tail command  
would become confused when the program's log is rewritten as you said  
it was.)

> Then the double && which seems a AND operator to me, never seen it  
> in this use case before.

"do the next thing only if the previous one succeeded", always a good  
idea when the alternative is data loss.

-- 
brandon s. allbery [solaris,freebsd,perl,pugs,haskell] allbery at kf8nh.com
system administrator [openafs,heimdal,too many hats] allbery at ece.cmu.edu
electrical and computer engineering, carnegie mellon university    KF8NH



-------------- next part --------------
A non-text attachment was scrubbed...
Name: PGP.sig
Type: application/pgp-signature
Size: 195 bytes
Desc: This is a digitally signed message part
URL: <http://lists.macosforge.org/pipermail/macports-users/attachments/20091219/96f1aa0f/attachment.bin>


More information about the macports-users mailing list