From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 13756 invoked from network); 4 Jan 1997 01:43:31 -0000 Received: from euclid.skiles.gatech.edu (list@130.207.146.50) by coral.primenet.com.au with SMTP; 4 Jan 1997 01:43:31 -0000 Received: (from list@localhost) by euclid.skiles.gatech.edu (8.7.3/8.7.3) id UAA00368; Fri, 3 Jan 1997 20:44:23 -0500 (EST) Resent-Date: Fri, 3 Jan 1997 20:44:23 -0500 (EST) Date: Fri, 3 Jan 97 17:44:11 PST From: morgan@usf.teradyne.com (Brady Morgan) Message-Id: <9701040144.AA16789@tachyon.usf.teradyne.com> To: zsh-workers@math.gatech.edu Subject: Problem with alias in 'if' blocks Resent-Message-ID: <"_G4Hq1.0.e5.tNRpo"@euclid> Resent-From: zsh-workers@math.gatech.edu X-Mailing-List: archive/latest/2718 X-Loop: zsh-workers@math.gatech.edu Precedence: list Resent-Sender: zsh-workers-request@math.gatech.edu I attempting to convert from Csh to Zsh and have run into the following problem. I've isolated the problem to the following script, "simple": (NOTE: this listing is shown with line numbers obtained using "cat -n") 1 #!/usr/local/bin/zsh 2 3 if [ 1 ]; then 4 alias mycmd='echo "MYCMD ALIAS"' 5 6 if [ 1 ]; then 7 mycmd 8 fi 9 10 mycmd 11 fi 12 13 mycmd When executed, I get this result: simple: command not found: mycmd [7] simple: command not found: mycmd [10] MYCMD ALIAS Can someone explain why the alias isn't "known" until I'm out of the "if" loop? Also, if I've goofed with this, could someone demonstrate the proper way to achieve the desired result. This script works with Csh (i.e., when it's in Csh syntax). I checked the Zsh documentation, the Zsh web site, and the DejaNews news archives, but couldn't find anything regarding this issue. Here's my setup: OS : SunOS 4.1.3_U1 sun4m Zsh Version: 3.0.2 Compiler : gcc version 2.7.2 Any help will be greatly appreciated!!