Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: activate alias inside subshell
On Apr 8, 7:56am, Ray Andrews wrote:
}
} Is 'zsh -f' the answer to the above -- a truly clean test of something?
The first thing asked following most bug reports is "can you reproduce
this from zsh -f?" So yes. Start from -f and then load the minimum
number of changes to try what you want to try (e.g., add extendedglob
if necessary, zmodload zsh/parameter or other required modules, etc.).
} So:
}
} $ alias msg ... ; test2 () { msg }
}
} and:
}
} $ alias msg ...
} $ test2 () { msg }
}
} ... are very different! In the former the alias is 'pending' in the
} latter, it is active, yes? That's easy not to know.
Yes, that's correct. "alias" is really intended only to make interactive
shells easier (reduce typing), not to abbreviate scripts (even if the
script is going to be used interactively later).
} BTW, results are hugely different if the redefined message function is
} redefined with or without 'function' prepended: " function msg () ... "
} vs. " msg () ... ". Most comments found on the internet suggest there
} should be no difference
There's no difference when "msg" is not an alias. But in
msg() ...
the word "msg" is in command position and therefore subject to alias
expansion, whereas in
function msg () ...
it is *not* in command position and will not be alias-expanded.
Messages sorted by:
Reverse Date,
Date,
Thread,
Author