From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 22144 invoked by alias); 1 Feb 2011 18:52:48 -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: 15745 Received: (qmail 19434 invoked from network); 1 Feb 2011 18:52:47 -0000 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on f.primenet.com.au X-Spam-Level: X-Spam-Status: No, score=-2.7 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FROM,RCVD_IN_DNSWL_LOW, T_TO_NO_BRKTS_FREEMAIL autolearn=ham version=3.3.1 Received-SPF: pass (ns1.primenet.com.au: SPF record at _spf.google.com designates 209.85.160.43 as permitted sender) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:message-id:date:from:user-agent:mime-version:to :subject:content-type:content-transfer-encoding; bh=9rhKDyz7YfsU/ijcyXHMnw5/oFKFpogL5YBcsLjaNtg=; b=HvkTtS3i2i2Azy4FXJubMdN6KpoRxRLgRAUS20YFHv4YxBxLcVFMr1aiw8QnrQ4kHY 3FTafzO1JwGgCYTDZ+zqrXwjYiC4wC4r0IkSc2TONYQaypR2mtzHBaxtz6YgUp76FcsB 2yBtvH7k4K7CG6NZlFO1Q85LQV5Z2CD9UcThM= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=message-id:date:from:user-agent:mime-version:to:subject :content-type:content-transfer-encoding; b=dG4On8ckoKIeHQfq36zY38c6ZhwOPktZJrjkA06cyPUDzATgMP2EH3XaBSsRQuxj2G KV3icApY3xpRAIKl+00u1K8IPYkLhmSm/Cvnd/BpkBy+Y55I7UjtYZVFEwU/XucFwAVs Mc69wePnRElKitOSIp5aEitUExIx43lI5R5z8= Message-ID: <4D4850F7.6060205@gmail.com> Date: Tue, 01 Feb 2011 23:59:11 +0530 From: Anonymous bin Ich User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.2.13) Gecko/20101208 Thunderbird/3.1.7 MIME-Version: 1.0 To: zsh-users@zsh.org Subject: Check existence of a program Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Hello! I am having trouble checking for existence of a program. This works: % cat working.zsh #!/bin/zsh set -x prog="identify" path=$(which ${prog}) % % ./working.zsh +./working.zsh:3> prog=identify +./working.zsh:4> path=+./working.zsh:4> which identify +./working.zsh:4> path=/usr/bin/identify % But this doesn't: % cat notworking.zsh #!/bin/zsh set -x prog="exiftime" path=$(which ${prog}) if [[ ${?} -ne 0 ]]; then prog="identify" path=$(which ${prog}) fi % % ./notworking.zsh +./notworking.zsh:3> prog=exiftime +./notworking.zsh:4> path=+./notworking.zsh:4> which exiftime +./notworking.zsh:4> path='exiftime not found' +./notworking.zsh:5> [[ 1 -ne 0 ]] +./notworking.zsh:6> prog=identify +./notworking.zsh:7> path=+./notworking.zsh:7> which identify +./notworking.zsh:7> path='identify not found' % Any idea?