Need help in setting aliases with ksh93
Issue
What problem/issue/behavior are you having trouble with? What do you expect to see?
We have an alias defined in our ksh environment (alias echo=’print’). This is not working even in scripts which are called from the command line.
Searching online shows “ksh93 does not support exported aliases or functions. If there is a shebang, the subshell execs the new interpreter and the new interpreter only inherits exported scalar variables.”
We need a way for the alias to work within our ksh scripts without updating our scripts individually as we have several thousands of them running in prod env that we do not have liberty to change.
Where are you experiencing the behavior? What environment?
Redhat 6.5 ksh93 shell
When does the behavior occur? Frequently? Repeatedly? At certain times?
for example, if you run the following:
echo_test.ksh
echo is a shell builtin
alias echo=’print’
type echo
echo is an exported alias for print
cat echo_test.ksh
#!/bin/ksh
type echo
echo_test.ksh
echo is a shell builtin
What information can you provide around timeframes and urgency?
We are migrating whole suite of apps which are currently running on a legacy environment with pdksh to a new environment which only supports ksh93. this was not caught during our initial testing, so we need to change the environment in a way where echo will run like the print command to support "\n", etc. without actually changing all the scripts (as we have thousands of them.
Environment
Red Hat Enterprise Linux
6.5
ksh93
Subscriber exclusive content
A Red Hat subscription provides unlimited access to our knowledgebase of over 48,000 articles and solutions.
Welcome! Check out the Getting Started with Red Hat page for quick tours and guides for common tasks.
