From owner-freebsd-questions@FreeBSD.ORG Mon Jun 10 19:22:36 2013 Return-Path: Delivered-To: freebsd-questions@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) by hub.freebsd.org (Postfix) with ESMTP id 1666C968 for ; Mon, 10 Jun 2013 19:22:36 +0000 (UTC) (envelope-from kudzu@tenebras.com) Received: from mail-ob0-x236.google.com (mail-ob0-x236.google.com [IPv6:2607:f8b0:4003:c01::236]) by mx1.freebsd.org (Postfix) with ESMTP id D8F971C85 for ; Mon, 10 Jun 2013 19:22:35 +0000 (UTC) Received: by mail-ob0-f182.google.com with SMTP id va7so10458950obc.41 for ; Mon, 10 Jun 2013 12:22:35 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :content-type:x-gm-message-state; bh=uR30w93tuSxYvFvVsJusUOf+tbCe/i6d6lk4bSV9V/Y=; b=iBfFDycLjGx43/owgEvE9qz9E6tV5fcoH56bl9Yv9v6gTr7tQxDqxIAyqzz+FZp9tm i8TF1KW5T4/h+6WzLQt/JLY3sHKqa9OZS6xE+xfwjgMGTvEwRzUNt94A7l6nZuHx3YHj c1qsIBV5aSY+959ve8iuSdWCuw7YPfy/IxjSKxvYUEovtMpRw7h7f0epc1vUtHNARzIl SDqei6bRKBT27igl0pbkhmWy3sf+IrOsDPDXpRIsBDoTJ9JEQwltpesXoWGwpAM7KfoY FJAiF4beY3jt1MnJNoEsegeLkpkpVik1Lwp/lP9HPnfzwIH+uQ5QYJZrDNQxreXQIFPa gd0g== MIME-Version: 1.0 X-Received: by 10.182.27.74 with SMTP id r10mr9275764obg.63.1370892155437; Mon, 10 Jun 2013 12:22:35 -0700 (PDT) Received: by 10.60.123.77 with HTTP; Mon, 10 Jun 2013 12:22:35 -0700 (PDT) In-Reply-To: <51B62622.1070201@tundraware.com> References: <51b620a6.42f.2b6a6400.5605dcf0@go2france.com> <121701ce660c$9a9aa5b0$cfcff110$@freebsd.org> <51B62389.5000500@tundraware.com> <121b01ce660e$2abae5f0$8030b1d0$@freebsd.org> <51B62622.1070201@tundraware.com> Date: Mon, 10 Jun 2013 12:22:35 -0700 Message-ID: Subject: Re: Bourne shell "if" syntax From: Michael Sierchio To: FreeBSD Questions Content-Type: text/plain; charset=ISO-8859-1 X-Gm-Message-State: ALoCoQk2KNgubN0sKRr0GMHq/K3r20mKyPBP91mCVq2JHGAN+/EsQZGISIlMOXTl/R01/U3uuUTA X-BeenThere: freebsd-questions@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: User questions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 10 Jun 2013 19:22:36 -0000 On Mon, Jun 10, 2013 at 12:16 PM, Tim Daneliuk wrote: > That wasn't really my point. I use sentinels because in the face of an > empty string this: > > if [ $PTR = "" ] > > Actually evaluates to: > > if [ = "" ] > > Which throws an error. Right. Many scripts seem to assume that sh is bash, and that's certainly not the case here. if [ "x$BLAH" = "x" ]; then is the most reliable and portable way of determining if it's a string of zero length. - M