From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from asmodean.asmotec.com ([168.103.204.168]) by speech.braille.uwo.ca with esmtp (Exim 3.36 #1 (Debian)) id 1FSM3r-0002pQ-00 for ; Sat, 08 Apr 2006 18:37:43 -0400 Received: by asmodean.asmotec.com (vPostMaster, from userid 500) id 76485901A8; Sat, 8 Apr 2006 16:37:10 -0600 (MDT) Date: Sat, 8 Apr 2006 16:37:10 -0600 From: "Raul A. Gallegos" To: speakup@braille.uwo.ca Subject: Re: help with a bash script please Message-ID: <20060408223710.GC2358@asmodean.asmotec.com> Mail-Followup-To: speakup@braille.uwo.ca References: <20060408221656.GB16356@localhost.localdomain> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20060408221656.GB16356@localhost.localdomain> X-Organization: Asmodean X-Operating-System: asmodean i686 athlon i386 GNU/Linux User-Agent: Mutt/1.5.9i X-BeenThere: speakup@braille.uwo.ca X-Mailman-Version: 2.1.7 Precedence: list Reply-To: "Speakup is a screen review system for Linux." List-Id: "Speakup is a screen review system for Linux." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 08 Apr 2006 22:37:43 -0000 Gregory Nowak said the following on Sat, Apr 08, 2006 at 03:16:56PM -0700: > I'm having trouble with an if statement in a bash script I'm > writing. What I want to do, is to check if a file doesn't have read > permission. What I'm doing is: > > if !([ -r filename]) Try this: if [ ! -r filename ]; then That should work. I tried this on a file called test with chmod 000 then chmod 666 and on 000 the script was true due to the exclamation but false when the file was chmod 666 since the script then made it false. The quick script I wrote is as follows: #!/bin/bash if [ ! -r test ]; then echo "this file is not readable" else echo "this file is readable" fi HTH. -- All I want is a warm bed and a kind word and unlimited power. -- Ashleigh Brilliant Raul A. Gallegos ... IliwSsmc