Path: csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!feeder.erje.net!eu.feeder.erje.net!newsfeed.xs4all.nl!newsfeed2.news.xs4all.nl!xs4all!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail Return-Path: X-Original-To: python-list@python.org Delivered-To: python-list@mail.python.org X-Spam-Status: OK 0.013 X-Spam-Evidence: '*H*': 0.97; '*S*': 0.00; 'python.': 0.02; 'scripts': 0.03; 'exit': 0.09; 'exits': 0.09; 'subject:files': 0.09; 'variable,': 0.09; 'cc:addr:python-list': 0.11; 'command.': 0.16; 'from:addr:rosuav': 0.16; 'from:name:chris angelico': 0.16; 'hazard': 0.16; 'imo,': 0.16; 'prep': 0.16; 'simpson': 0.16; 'subject:program': 0.16; 'wrappers': 0.16; 'followed': 0.16; 'sat,': 0.16; 'wrote:': 0.18; 'saying': 0.22; 'shell': 0.22; 'cc:addr:python.org': 0.22; 'cc:2**0': 0.24; 'options': 0.25; 'script': 0.25; 'values': 0.27; 'header:In-Reply-To:1': 0.27; 'am,': 0.29; 'message-id:@mail.gmail.com': 0.30; '(which': 0.31; 'that.': 0.31; 'usually': 0.31; 'accidentally': 0.31; 'sep': 0.31; 'stuff': 0.32; 'run': 0.32; 'something': 0.35; 'but': 0.35; 'received:google.com': 0.35; 'there': 0.35; 'fun,': 0.36; 'subject:data': 0.36; 'changing': 0.37; 'though,': 0.39; 'major': 0.40; 'even': 0.60; 'commands': 0.60; 'tag': 0.61; 'course': 0.61; 'simple': 0.61; "you're": 0.61; 'further': 0.61; 'times': 0.62; 'such': 0.63; 'more': 0.64; 'great': 0.65; 'here': 0.66; 'believe': 0.68; '20,': 0.68; 'design.': 0.68; 'default': 0.69; 'bulk': 0.74; 'careless': 0.84; 'to:none': 0.92 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:cc :content-type; bh=8nd0KEIOjxmFPBh4xIURBHf4rG9jSUIUpr1Doq7x9G0=; b=ZoDs0UKoyKwjRY/WqJoEF3KascouRbj5imjv7X5S27zzM9TrxIzWNow9NL9ZEEzlDt U5gOfWjuAyJ+hcwarrq6yRlBC8kE866o1IXXioqRfvUh5Z/+cpfapuueQwkMIPTYQbVD 8JXxQOYFWjEWOpv8k3U/s5RfoEQo6v47wZw9YaGElEI8KnErWshkfEuPzlcXL5OLeeRx 57e0SEzj4FfNeebTtDfVopKFUMocMm/5m2NG2TDG3ezhui18mX2+Z5IxrwUs7EkJ8HGK QdC66HDWCtz9owNLf/o/QuSP604w5Bh0RMpFeuf3GJ0tjUTAAxuYtZ5rgdpTIjsMpxNQ BiDw== MIME-Version: 1.0 X-Received: by 10.50.117.65 with SMTP id kc1mr1108149igb.34.1411188819133; Fri, 19 Sep 2014 21:53:39 -0700 (PDT) In-Reply-To: <20140920002745.GA43639@cskk.homeip.net> References: <20140920002745.GA43639@cskk.homeip.net> Date: Sat, 20 Sep 2014 14:53:39 +1000 Subject: Re: program to generate data helpful in finding duplicate large files From: Chris Angelico Cc: "python-list@python.org" Content-Type: text/plain; charset=UTF-8 X-BeenThere: python-list@python.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: General discussion list for the Python programming language List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Newsgroups: comp.lang.python Message-ID: Lines: 34 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1411189137 news.xs4all.nl 2930 [2001:888:2000:d::a6]:50410 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:78096 On Sat, Sep 20, 2014 at 10:27 AM, Cameron Simpson wrote: > IMO, it is good that the shell is like that. It isn't Python. > > A great many small shell scripts are one liner wrappers, and this serves > them well. A great many more are a lot of prep work followed by a major (and > final) command. These are also served well. > > There is the hazard where someone careless goes: > > ... main script ... > echo "script failed!" >&2 > > and accidentally exits with 0 (success). > > For further fun, I run my shell scripts with the -e and -u options turned > on. > > And of course for complicated stuff I usually maintain a $xit variable, > setting it to 1 when something goes blam, and finishing such scripts with: > > exit $xit > > But for wrappers, the shell default exit design is handy. What you're saying here is that there are times when it's convenient, and other times when it's inconvenient. And sure! That's definitely true. What I contest, though, is that having it this way is the better design. Even if the bulk of shell scripts are wrappers for single commands and want to exit with their return values (which I suspect is not the case), I believe the better design would be to have them put a simple tag onto it like "|| exit $?". Of course, there's no changing it now. ChrisA