Hi..please see the below output
[linux@cent0primary ~]$ 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
[linux@cent0primary ~]$
There is no output for this below command
[linux@cent0primary ~]$ source ~/.bash_profile
[linux@cent0primary ~]$ echo $?
0
[linux@cent0primary ~]$
[linux@cent0primary ~]$ echo $PATH
/usr/kerberos/bin:/usr/local/bin:/usr/bin:/bin:/usr/X11R6/bin:/home/linux/bin:/home/linux/bin:/home/linux/bin
[linux@cent0primary ~]$
I added these below two lines before "export PATH" in .bash_profile file in root user's home(/root) directory as well as linux user's home directory.
PATH1=/sbin/:/usr/sbin/:/bin/:/usr/bin/:$PATH
export PATH1
The path variable has been set to only root user and it is working fine i.e we no need to give full path of command. But for linux user it is not working. everytime I have to export the path manually.
As you told I edited /etc/profile and & added path1 entry as below after HISTSIZE
HOSTNAME=`/bin/hostname`
HISTSIZE=1000
PATH1=/sbin/:/usr/sbin/:/bin/:/usr/bin/:$PATH
& also added an entry for path1 in export line as below
export PATH USER LOGNAME MAIL HOSTNAME HISTSIZE PATH1 INPUTRC
Although, The path variable is working fine for only root user and not for any other user.
I checked it after 2 reboot also but it is not working apart from root.
Quote:
Originally Posted by catkin
What is the output from these commands:
Code:
cat ~/.bash_profile
source ~/.bash_profile
echo $PATH
BTW, this looks wrong
Code:
PATH1=/sbin/:$PATH /usr/sbin/:$PATH /bin/:$PATH /usr/bin/:$PATH
better
Code:
PATH1=/sbin/:/usr/sbin/:/bin/:/usr/bin/:$PATH
but it does not affect $PATH which is the real problem.
|