See the code below:a()(alias x=echo\ hi;type x;alias;x);aI have an alias inside a function, I do not want to change the external environment (that is why I am using () instead of {}), even the code saying the alias was successfully setted, it does not work, check the output out:x is aliased to `echo hi'...alias x='echo hi'x: command not foundI heard about doing shopt -s expand_aliases would solve, but not only it has not had any effect as well as I could not depend on bash because I am working with dd-wrt's busybox's ash.Someone know this issue?
Why alias inside function does not work?
shell;shell script;alias;function;dash
If you're not averse to using eval:$ busybox ash -c 'a()(alias x=echo\ hi;type x;alias;eval x);a'x is an alias for echo hix='echo hi'hiI have no idea why this works.