Also I'd like to ask a question about aliases. Right now, if alias is
set inside of a sourced script, it does not have effect on sourced
script itself. For example:
testA.sh:
#!/bin/ksh
. ./testB.sh
echo "A\nB\nC\n"
testB.sh:
alias echo='echo -e'
alias echo
type echo
echo "1\n2\n\3\n"
output is:
echo='echo -e'
echo is an alias for 'echo -e'
1\n2\n\3\n
A
B
C
Is this expected behaviour?
Yes, 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.
Ok, I read the man page, but I asked because I've seen that ksh in
opensuse is built with patch that makes alias work in sourced scripts.
So I was wondering if they fixed it to work as expected or broke it to
work differently than designed.
_______________________________________________
ast-developers mailing list
[email protected]
https://mailman.research.att.com/mailman/listinfo/ast-developers