Reputation: 37
I have created a bash_profile in centos
#vi /home/hadoop/.bash_profile
as follow:
# .bash_profile
# User specific environment and startup programs
export j=1
However, when I do
[root@hadoop1 ~]# su hadoop
[hadoop@hadoop1 root]$ echo $j
[hadoop@hadoop1 root]$
I suppose my .bash_prfile shoud run for each su login?
Upvotes: 2
Views: 1896
Reputation: 661
The .bash_profile
won't load unless you use one of the -
, -l
, or --login
options or login directly with that user. Checkout this link is from the Unix & Linux stack exchange. You can also run man su
in the shell to see all the available options.
Upvotes: 4