Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Problem with alias in 'if' blocks
- X-seq: zsh-workers 2718
- From: morgan@xxxxxxxxxxxxxxxx (Brady Morgan)
- To: zsh-workers@xxxxxxxxxxxxxxx
- Subject: Problem with alias in 'if' blocks
- Date: Fri, 3 Jan 97 17:44:11 PST
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!!
Messages sorted by:
Reverse Date,
Date,
Thread,
Author