This is the mail archive of the cygwin mailing list for the Cygwin project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: /bin/ gets deleted on error


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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]