From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 12043 invoked by alias); 10 Apr 2015 02:03:01 -0000 Mailing-List: contact zsh-users-help@zsh.org; run by ezmlm Precedence: bulk X-No-Archive: yes List-Id: Zsh Users List List-Post: List-Help: X-Seq: 20122 Received: (qmail 26868 invoked from network); 10 Apr 2015 02:02:59 -0000 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on f.primenet.com.au X-Spam-Level: X-Spam-Status: No, score=-2.6 required=5.0 tests=BAYES_00,HTML_MESSAGE, RCVD_IN_DNSWL_LOW autolearn=ham version=3.3.2 X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:in-reply-to:references:date :message-id:subject:from:to:cc:content-type; bh=t4ofriu4uShBd0LG1O353vWvxjA3bPTF/GuyxMjoKag=; b=P/gfXFHQSOVxsTCSyPDGq3VDappIHSJTCYJcnppwZEHQ4r/n7/KFm8OdIz1tc0WBuS eG/wG5w125SM6LuGqHpwOwUIx3cl6TGqpK0xTcPEfrxmyyk64f+wgF+Brc5WwWt5tyO2 /n9ANiBeqPUvBZ9Ek1gA2SeqgjHiVx0FHosBynvKoU7NyIb54XsB014A31zCmlUOQDM5 RBsARlQ4opnT1f43jeE9QLkc1SD2oDXVv9XUxgfoacM3hiuP1s2ZWkCNR6QVTWIkAcvM KMtN4PPcg0d4GXNkZ9UjIP+zjX+SDKGV0ferAx8Z/zcgG4HUdx3i/hFTxAJLZ9tFKOnd y3yA== X-Gm-Message-State: ALoCoQnJJ04DVQZmTJiaJUwKvmUVQJI20/AEtz0D1XL9nIJuYQovMnXnzZa7WSOxoVWQjY8q5ZlT MIME-Version: 1.0 X-Received: by 10.152.22.72 with SMTP id b8mr6925171laf.1.1428631374161; Thu, 09 Apr 2015 19:02:54 -0700 (PDT) In-Reply-To: References: Date: Thu, 9 Apr 2015 19:02:54 -0700 Message-ID: Subject: Re: `[[ -n $VAR ]]` equal to `[[ $VAR ]]`? From: Kurtis Rader To: Thorsten Kampe Cc: Zsh Users Content-Type: multipart/alternative; boundary=089e0158b832927ec8051355297f --089e0158b832927ec8051355297f Content-Type: text/plain; charset=UTF-8 Okay, I had forgotten that a bare string is equivalent to "-n string" in bash. The zsh documentation makes no mention of this "feature". It probably works for you and not me because of an option that differs between our two environments. Although for the life of me I can't figure out what that option is. On Thu, Apr 9, 2015 at 6:39 PM, Thorsten Kampe wrote: > * Kurtis Rader (Thu, 9 Apr 2015 18:31:04 -0700) > > When I run the following > > > > [[ $VAR ]] && print yes > > > > I get a parse error. Which is what I expected given the documentation in > > section "Conditional Expressions" of "man zshall". Are you seeing > different > > behavior? What makes you think a bare variable is a valid expression? > > > ``` > VAR= > > if [[ $VAR ]] > then > printf "something\n" > else > printf "nothing\n" > fi > ``` > > Works fine in zsh and bash. > > Same goes for > `[[ $VAR ]] && printf "something\n" || printf "nothing\n"` > > -- Kurtis Rader Caretaker of the exceptional canines Junior and Hank --089e0158b832927ec8051355297f--