Skip to Main Content

Infrastructure Software

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

something strange with sourcing .bash_profile

EdStevensDec 4 2009 — edited Dec 18 2009
OEL 4 on VMware Player on XP Pro

I've installed OEL 4 on a VMware Player machine. (Also installed Oracle 10.2.0.4 with latest CPU and created a db. All that is working as expected)

BUt I'm seeing what appears to be strange behavior concerning sourcing the .bash_profile.

First I fire up the VM and log on as user 'oracle' which takes me to a gnome desktop but because I'm a command line type of guy, I open a terminal:

First, here's my .bash_profile:
[oracle@vmsvr01 ~]$ clear

[oracle@vmsvr01 ~]$ pwd
/home/oracle
[oracle@vmsvr01 ~]$ cat .bash_profile
# .bash_profile

# Get the aliases and functions
if [ -f ~/.bashrc ]; then
        . ~/.bashrc
fi

# User specific environment and startup programs

PATH=$PATH:$HOME/bin

export PATH
unset USERNAME
# added by Ed Stevens
set -o vi
export ORACLE_SID=vmora1
export ORACLE_BASE=/u01/app/oracle
export ORACLE_OWNER= oracle
export ORACLE_HOME=$ORACLE_BASE/product/10.2.0/db_1
export PATH=$ORACLE_HOME/bin:$PATH
alias bdump='cd $ORACLE_BASE/admin/$ORACLE_SID/bdump; pwd; ls -ltr'
alias oranet='cd $ORACLE_HOME/network/admin; pwd; ls -l'
alias oadmin='cd $ORACLE_BASE/admin/$ORACLE_SID; pwd; ls -ltr'
so, let's check one of the env vars I set:
[oracle@vmsvr01 ~]$ echo $ORACLE_SID
vmora1
Good enough. Let's check my aliases:
[oracle@vmsvr01 ~]$ alias
alias l.='ls -d .* --color=tty'
alias ll='ls -l --color=tty'
alias ls='ls --color=tty'
alias which='alias | /usr/bin/which --tty-only --read-alias --show-dot --show-tilde'
Huh? Where's the ones I set in my profile: bdump, oranet, and oadmin?

But if I now source the profile, I get the aliases:
[oracle@vmsvr01 ~]$ . ./.bash_profile
[oracle@vmsvr01 ~]$ alias
alias bdump='cd $ORACLE_BASE/admin/$ORACLE_SID/bdump; pwd; ls -ltr'
alias l.='ls -d .* --color=tty'
alias ll='ls -l --color=tty'
alias ls='ls --color=tty'
alias oadmin='cd $ORACLE_BASE/admin/$ORACLE_SID; pwd; ls -ltr'
alias oranet='cd $ORACLE_HOME/network/admin; pwd; ls -l'
alias which='alias | /usr/bin/which --tty-only --read-alias --show-dot --show-tilde'
[oracle@vmsvr01 ~]$
So why, on initial entry, I get the env vars that are defined only in .bash_profile, but I don't get the aliases defined there until I specifically source the profile?
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Jan 15 2010
Added on Dec 4 2009
11 comments
3,508 views