Is there a way to export aliases in macOS in the Korn Shell (ksh)?

Earlier versions of the Korn shell (ksh) allowed aliases to be exported to subshells by using the -x option, for example:

alias -x dog=cat

With the current version of macOS the ksh man page says:

"The obsolete -x option has no effect."

Is there an alternate way to export aliases in macOS in ksh without putting them in .kshrc?


I am not much of a ksh user so some other users will probably be able to improve on this answer. (Or disapprove.)

While I have not found how to export aliases, I have found how to save the aliases to an exported variable. The script in the .kshrc file can be modified to recreate the aliases stored in this variable. The proposed commands to add to the .kshrc file are shown below

if [[ ${#LISTOFALIASES} != 0 ]]; then
    ALIASIFSBACKUP="$IFS"
    IFS=$'\n'
    while read -r CURRENTALIAS; do
        eval "command -p alias $CURRENTALIAS"
    done <<< "$LISTOFALIASES"
    IFS="$ALIASIFSBACKUP"
    unset ALIASIFSBACKUP CURRENTALIAS
fi
export LISTOFALIASES
aliasx() { command -p alias "$@"; LISTOFALIASES="$(command -p alias)"; }
unaliasx() { command -p unalias "$@"; LISTOFALIASES="$(command -p alias)"; }
command -p alias alias=aliasx
command -p alias unalias=unaliasx