X-Recipient: archive-cygwin AT delorie DOT com X-SWARE-Spam-Status: No, hits=-2.2 required=5.0 tests=AWL,BAYES_00 X-Spam-Check-By: sourceware.org Content-class: urn:content-classes:message MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable Subject: RE: Bash - IF Statement Date: Tue, 27 Oct 2009 15:07:04 -0500 Message-ID: <786EBDA1AC46254B813E200779E7AD365C3EEA@srv1163ex1.flightsafety.com> In-Reply-To: <26084169.post@talk.nabble.com> References: <26084169 DOT post AT talk DOT nabble DOT com> From: "Thrall, Bryan" To: X-IsSubscribed: yes Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: 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 briglass111 wrote on Tuesday, October 27, 2009 3:02 PM: > I am trying to write an IF Statement in Bash, but I am having issues. It > doesn't like the following format: >=20 > echo "yes or no?" > read T >=20 > if ["$T"=3D"y"]; > then > echo "YES" > fi >=20 > .............. It also doesn't like the following alternatives: >=20 > if [$T=3D"y"]; > if ["$T"=3D=3D"y"]; > if [$T=3D=3D"y"]; > if "$T"=3D"y"; > if [["$T"=3D"y"]]; >=20 > etc.. >=20 > It says: > y=3Dy: command not found >=20 > Ideas? You need to add some whitespace so bash can distinguish commands and arguments: $ if [ "$T" =3D "y" ]; then echo "YES"; fi YES BTW, this is not a Cygwin-specific question :) --=20 Bryan Thrall FlightSafety International bryan DOT thrall AT flightsafety DOT com -- 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