From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 12563 invoked by alias); 1 Feb 2011 20:17:17 -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: 15749 Received: (qmail 8869 invoked from network); 1 Feb 2011 20:17:16 -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=-1.9 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_NONE autolearn=ham version=3.3.1 Received-SPF: none (ns1.primenet.com.au: domain at closedmail.com does not designate permitted sender hosts) From: Bart Schaefer Message-id: <110201121656.ZM18559@torch.brasslantern.com> Date: Tue, 01 Feb 2011 12:16:56 -0800 In-reply-to: <4D4850F7.6060205@gmail.com> Comments: In reply to Anonymous bin Ich "Check existence of a program" (Feb 1, 11:59pm) References: <4D4850F7.6060205@gmail.com> X-Mailer: OpenZMail Classic (0.9.2 24April2005) To: zsh-users@zsh.org Subject: Re: Check existence of a program MIME-version: 1.0 Content-type: text/plain; charset=us-ascii On Feb 1, 11:59pm, Anonymous bin Ich wrote: } } % cat notworking.zsh } #!/bin/zsh } set -x } prog="exiftime" } path=$(which ${prog}) As has already been pointed out, assigning to $path alters the value of $PATH, which makes it impossible to find any other executables. One way to prevent yourself from getting into trouble with this: readonly path Now you can still assign to PATH (and the new value is reflected in the $path array), but you can't accidentally stomp on it via direct assignment to path.