www.delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2017/04/14/08:42:47

X-Recipient: archive-cygwin AT delorie DOT com
DomainKey-Signature: a=rsa-sha1; c=nofws; d=sourceware.org; h=list-id
:list-unsubscribe:list-subscribe:list-archive:list-post
:list-help:sender:subject:to:references:from:message-id:date
:mime-version:in-reply-to:content-type
:content-transfer-encoding; q=dns; s=default; b=mbyCiUwVbc+bxkbh
VcX9TFGVEqRG/HXPh+h3Vj9T5D+lomGYW+2M1YK7lNcGkY6aupJY/50SbLDhZdbT
gEiwbDuUNo6LSCEVywTEUUR+/mNtOzvDwYxq7My83tYWJcRiaDQGxfRfycva7OPf
m+b81RjAOPI2BqLtRnlddkLDztg=
DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=sourceware.org; h=list-id
:list-unsubscribe:list-subscribe:list-archive:list-post
:list-help:sender:subject:to:references:from:message-id:date
:mime-version:in-reply-to:content-type
:content-transfer-encoding; s=default; bh=DSSBU6mMACoQbcPs2dyMeH
UsLHw=; b=JGjVqfPpSyAB7EG/bJJvJafbhb1GRIPr2WsVNz2svsiaES0zOoRwsb
sW4ylA72LSXFlxpdTj0nzcnMLmRrqmOhsUpbcTicUCEIKilIqfuwt0baDMI/dUjT
NI1zbb3ZNxeAYpT6QIM5FFxtMYKujaVVcRqzHLx/27UNAJPnXm8do=
Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm
List-Id: <cygwin.cygwin.com>
List-Subscribe: <mailto:cygwin-subscribe AT cygwin DOT com>
List-Archive: <http://sourceware.org/ml/cygwin/>
List-Post: <mailto:cygwin AT cygwin DOT com>
List-Help: <mailto:cygwin-help AT cygwin DOT com>, <http://sourceware.org/ml/#faqs>
Sender: cygwin-owner AT cygwin DOT com
Mail-Followup-To: cygwin AT cygwin DOT com
Delivered-To: mailing list cygwin AT cygwin DOT com
Authentication-Results: sourceware.org; auth=none
X-Virus-Found: No
X-Spam-SWARE-Status: No, score=-1.4 required=5.0 tests=AWL,BAYES_00,FREEMAIL_FROM,RCVD_IN_DNSWL_NONE,RCVD_IN_SORBS_SPAM,SPF_PASS autolearn=no version=3.3.2 spammy=disasters, $foodir, foodir, defensive
X-HELO: mail-io0-f177.google.com
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:references:from:message-id:date :user-agent:mime-version:in-reply-to:content-transfer-encoding; bh=2EukFqbMDByYcRvhymBeL/a5P7tHR9EaGREvFBCayEo=; b=tOeuRo9bLmA5NkKXU3Bxq2GNOn2N8e+aa7ip8EUgg3+57AM0W9oxEjnQqsECxTM7Ap rFLcLULeHuk9v87mEk8fEw3XyUCLO+/fsLaHmCZfQqpcFU1fagqtkCQmwlL18o4Y+SjE QiTrN6U+AtGnCWfpzv+2dX0wz9ZwlhTYXDX0u8dtmbOxvEt2PiJ7bA8ieGShUk6irLjJ Fda2C9MkFoB7zF4+RgfwlhQiZ2NHqn1vasbKgmrtQkAFi9AteQn/KjwYJXOc5cvEfqKt hj2R5t07COQPe+YA7s2GqhlEk0TnjZnxoEg/cgIxGclqPTOMaFkrMlRoQnLduKzoVnQz R8Vg==
X-Gm-Message-State: AN3rC/5uQaIQADFj9bGI7hrHqqNguvPbcmtOZ+GesNo1zw2pA1FKn5o3 CdVr6i0+v8QiLnJn
X-Received: by 10.36.219.195 with SMTP id c186mr24395228itg.25.1492173746611; Fri, 14 Apr 2017 05:42:26 -0700 (PDT)
Subject: Re: /bin/ gets deleted on error
To: cygwin AT cygwin DOT com
References: <CAMZ6u3sxGACjd12x+_p75fX_dMDYLLj6KXOysq2T_iH6hoHNDw AT mail DOT gmail DOT com> <58EFB88A DOT 5090807 AT tlinx DOT org> <CAPF-yObM81YpnK52F7uNxKu6jaxNAL3xQiy7KZQyXSZeomxodg AT mail DOT gmail DOT com> <df96eab9-367e-c139-a769-dbdd4d4b7700 AT SystematicSw DOT ab DOT ca>
From: cyg Simple <cygsimple AT gmail DOT com>
Message-ID: <2a9f35c8-9d7a-c3a9-68b4-b2f3602474e5@gmail.com>
Date: Fri, 14 Apr 2017 08:42:38 -0400
User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:45.0) Gecko/20100101 Thunderbird/45.8.0
MIME-Version: 1.0
In-Reply-To: <df96eab9-367e-c139-a769-dbdd4d4b7700@SystematicSw.ab.ca>
X-IsSubscribed: yes

On 4/13/2017 2:43 PM, Brian Inglis wrote:

> defensive coding is your friend to avoid disasters: 
> 	if [ -n "$foodir" ] && [ -d $foodir/ ]; then
> 	  /bin/rm -fR -- $foodir || exit
> 	else
> 	  echo "Can't find directory '$foodir'"
> 	  exit 2
> 	fi
> 

And even this can be troublesome if you mistype a variable name anywhere
in this code.

-- 
cyg Simple

--
Problem reports:       http://cygwin.com/problems.html
FAQ:                   http://cygwin.com/faq/
Documentation:         http://cygwin.com/docs.html
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019