Log on as the user who executes the script, export the environment variables that are set in the script at the command line, then "env". Chances are something like this:

export PATH=$PATH:$ORACLE_HOME/bin:$ORACLE_HOME/lib

is the problem ($ORACLE_HOME still pointing to 9i home).