Ksh has following note in the manual:

|       The  built-in  command  . file reads the whole file before any
commands
|       are executed. alias and unalias commands in the file do  not
apply  to
|       any commands defined in the file.

This is not quite convenient in interactive shells when dotting (.) kshrc
files. For example, following code in kshrc would not work as one usually
expects:

if [[ -x /usr/gnu/bin/ls ]]; then
    alias _ls='/usr/gnu/bin/ls'
else
    alias _ls=/bin/ls
fi
if _ls --color=auto / > /dev/null 2>&1; then
    alias ls='_ls --color=auto'
fi

Instead it must be defined like this:

if [[ -x /usr/gnu/bin/ls ]]; then
    alias _ls='/usr/gnu/bin/ls'
    if /usr/gnu/bin/ls --color=auto / ; then
        alias ls='_ls --color=auto'
    fi
else
    alias _ls=/bin/ls
    if /bin/ls --color=auto / ; then
        alias ls='_ls --color=auto'
    fi
fi

Or we have to use two separate kshrc files, define `_ls' in the first one
and reference to `_ls' in the second one.

So can we consider adding one new `set -o' option to make it behave like in
Bash?

-Clark
_______________________________________________
ast-users mailing list
[email protected]
https://mailman.research.att.com/mailman/listinfo/ast-users

Reply via email to