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=n58UHIgIIJXOIpO5 N/otliekzO5KiaepI3fH2NdOY8TWLuJgGEfiT3Jchn7XfXtmXioR5Jby6KfklvGh Hx+v30CMZczCLoG5nvUattD2bNCnOPy4sDdAug0YYt8vQiNK328bxcARkbe1aqWk PXmXykS7FMjo0pC8ajPxi8NjnhU= 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=SSoYHOn9ukcG02Flk6tbsG Bp3sE=; b=HoUr1sMHGT/2dR+Skqm8mmPV6nP0fv6AB1djg3wmCvpfFYjPaJJAIB HW8hlzqPjVNDQVg1p73touHhj01++TTmFYr+c1+h06WbLzY5uiBq7CfVc7DqpoAV wYWD6oVQB/ahDJnBfz56WFNxKTZ1DRHtoXH74uE6mCpHZaMzFoYyY= Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , 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=0.8 required=5.0 tests=BAYES_50,RP_MATCHES_RCVD,SPF_PASS autolearn=ham version=3.3.2 spammy=disasters, foodir, defensive, inglis X-HELO: endymion.arp.harvard.edu Subject: Re: /bin/ gets deleted on error To: cygwin AT cygwin DOT com References: <58EFB88A DOT 5090807 AT tlinx DOT org> <2a9f35c8-9d7a-c3a9-68b4-b2f3602474e5 AT gmail DOT com> From: Norton Allen Message-ID: <0af85791-c5a1-e2fe-fe71-3463e5545a7f@huarp.harvard.edu> Date: Fri, 14 Apr 2017 10:33:34 -0400 User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:45.0) Gecko/20100101 Thunderbird/45.8.0 MIME-Version: 1.0 In-Reply-To: <2a9f35c8-9d7a-c3a9-68b4-b2f3602474e5@gmail.com> Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit X-IsSubscribed: yes On 4/14/2017 8:42 AM, cyg Simple wrote: > 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. > Or there are spaces in $foodir -- 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