Missing alias definitions after involve another shell

I setup alias on my .bash_profile. It works very will until I did another sh on command prompt. I typed alias on new shell and all the definitions did not carry over. How to correct this? Thanks in advance.

give some examples...

According to the bash man page , .bash_profile is executed for a login shell, while .bashrc is executed for interactive non-login shells. When you invoke another bash shell on the command line you are invoking an interactive non-login shell; hence the alias definitions in your .bash_profile are not available.

alias OH='cd ${ORACLE_HOME}' is in both .bash_profile and .bashrc.
-> echo $HOME;alias OH
/home/oracle
alias OH='cd ${ORACLE_HOME}'
after following command:
-> sh
-> echo $HOME;alias OH
/home/oracle
sh: alias: OH: not found

alias does not exist anymore but export value still there.

Try to start a new shell with bash instead of sh.

Regards

Thanks for your info. You are correct but I do not understand why. Both sh and bash are using /bin/bash. I thought they should act the same.

-> type sh
sh is hashed (/bin/sh)
-> ls -lt /bin/sh
lrwxrwxrwx 1 root root 4 Nov 30 2007 /bin/sh -> bash

-> type bash
bash is hashed (/bin/bash)
-> ls -lt /bin/bash
-rwxr-xr-x 1 root root 772760 Apr 12 2006 /bin/bash

bash examines the name it's running as, and behaves differently if it's sh

Can you give an example? Thanks.

Read the bash manual page.

Excerpt from the man page of bash:

Regards