Hide Forgot
Description of problem: ksh fails to process alias (echo='echo -e') in ksh-20100621-6.el6.x86_64 Version-Release number of selected component (if applicable): How reproducible: Always Steps to Reproduce: ksh kshTest.ksh **************************************************** # cat kshTest.ksh #!/bin/ksh . kshTestI.ksh typeset -ft hugo hugo "Install Apache Xerces (C++/Perl)" echo "\n\n Hello My dear Friend \n" ************************************************** # cat kshTestI.ksh #!/bin/ksh alias echo='echo -e' hugo() { alias echo echo "\n\n ==== ${0##*/}: $1 ====\n" } ************************************************* Actual results: echo='echo -e' \n\n ==== kshTest.ksh: Install Apache Xerces (C++/Perl) ====\n Hello My dear Friend Expected results: echo='echo -e' ==== kshTest.ksh: Install Apache Xerces (C++/Perl) ==== Hello My dear Friend Additional info: Issue is always reproducible in f15 ksh(ksh-20110630-3.fc15.x86_64) as well. Customer says, the same works successfully in OpenSuSE 11.4 ksh(ksh-93t-176.2.x86_64). I think the sneaky guys at SuSE didn't pulled the patch upstream.
This is how it's designed to work. man page: aliases: Aliasing is performed when scripts are read, not while they are executed. Therefore, for an alias to take effect, the alias definition command has to be executed before the command which references the alias is read. . name: Otherwise if name refers to a file, the file is read in its entirety and the commands are executed in the current shell environment. And confirmed from upstream: ========================================================= this is documented behavior. aliases are expanded when reading a script and a dot script is read in its entirety before running any commands. Therefore, any aliases defined in a . script (or function) will not take effect for that dot script or function. However, profile files are read an processed one command at a time unlike dot scripts. ========================================================= so this is a wontfix