Article View: news.software.readers
Article #70986Re: Sorting .newsrc in Unix shell accoutn
From: Sylvan Butler
Date: Tue, 23 Jan 2001 00:41
Date: Tue, 23 Jan 2001 00:41
36 lines
2524 bytes
2524 bytes
On Tue, 23 Jan 2001 00:45:49 +0100, Happl Oberlin <happl@mail.com> wrote:
>In article <94ff7m$fre$1@redenix.uni-muenster.de>, Dirk Nimmich
><nimmich@uni-muenster.de> wrote:
>
>>>> (sort < .newsrc > newsrc.$$$ ; mv newsrc.$$$ .newsrc)
>>> Why not "sort .newsrc -o .newsrc"?
>>Because this -- as well as the example above -- can trash your
>>newsrc if something goes wrong. Use
Good catch.
>>sort < .newsrc > .newsrc.$$$ && mv .newsrc.$$$ .newsrc
>>
>>instead to be on the safe side.
>
>If "sort -o" is not safe, then "mv" is not safe, too.
>And has to be replaced by "copy ... && rm ...".
The sort is much more likely to fail than a simple file mv operation.
The sort is data sensitive.
>And why you use "$$$"? I would use just "$$" for the PID.
because I've seen shells that would have two different pids for the two
seperate operations on a single commandline. I don't know the
definition for the $$ to know if it is supposed to be safe outside of a
script and the observered behavior is just an aberration.
sdb
--
| Sylvan Butler | Not speaking for Hewlett-Packard | sbutler-boi.hp.com |
| Watch out for my e-mail address. Thank UCE. #### change ^ to @ #### |
They that can give up essential liberty to obtain a little temporary
safety deserve neither liberty nor safety. --Benjamin Franklin, 1759
"Don't Tread On Me!"
Technical Details
Message-ID:
<slrn96pks3.7c6.Znospam+noZs_0101@hpb13799Z.Zboi.hpZ.com.invalid>Path:
mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!illumos!news.pugleaf.net!.TX!archive.pugleaf.net!archive.newsdeef.eu!mbox2nntp-news.software.readers.mbox.zip!supernews.google.com!sn-xit-02!supernews.com!nntp-relay.ihug.net!ihug.co.nz!newsfeed.berkeley.edu!ucberkeley!ihnp4.ucsd.edu!sdd.hp.com!hp-corv.cv.hp.com!hpb10302.boi.hp.com!Znospam+noZs_0101References:
<3a6791fd$0$1517$53a6afc1@news.erinet.com> <slrn96h2n6.7c6.Znospam+noZs_0101@hpb13799Z.Zboi.hpZ.com.invalid> <happl-181346.19520321012001@news.bluewin.ch> <94ff7m$fre$1@redenix.uni-muenster.de> <happl-6AF2AD.00454923012001@news.bluewin.ch>Show Full Headers
Complete Article Headers
Message-ID: <slrn96pks3.7c6.Znospam+noZs_0101@hpb13799Z.Zboi.hpZ.com.invalid> Subject: Re: Sorting .newsrc in Unix shell accoutn Date: Tue, 23 Jan 2001 00:41:57 +0000 From: Znospam+noZs_0101@hpb13799Z.Zboi.hpZ.com.invalid (Sylvan Butler) References: <3a6791fd$0$1517$53a6afc1@news.erinet.com> <slrn96h2n6.7c6.Znospam+noZs_0101@hpb13799Z.Zboi.hpZ.com.invalid> <happl-181346.19520321012001@news.bluewin.ch> <94ff7m$fre$1@redenix.uni-muenster.de> <happl-6AF2AD.00454923012001@news.bluewin.ch> Path: mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!illumos!news.pugleaf.net!.TX!archive.pugleaf.net!archive.newsdeef.eu!mbox2nntp-news.software.readers.mbox.zip!supernews.google.com!sn-xit-02!supernews.com!nntp-relay.ihug.net!ihug.co.nz!newsfeed.berkeley.edu!ucberkeley!ihnp4.ucsd.edu!sdd.hp.com!hp-corv.cv.hp.com!hpb10302.boi.hp.com!Znospam+noZs_0101 Newsgroups: news.software.readers Organization: Hewlett-Packard Mail-Copies-To: never User-Agent: slrn/0.9.6.2 (Linux) NNTP-Posting-Host: hpb13799.boi.hp.com X-Trace: 22 Jan 2001 17:41:57 -0700, hpb13799.boi.hp.com Lines: 35