Hello all,
Running Linux Kernel: 2.4.19-16mdk
Bash version: 2.05b.0
I've been doing some online tutorials on BASH shell scripting.
I created a script called "foobar" in my home directory. I gave the script (chmod 755 foobar) permissions. Couldn't figure out how to run the script by just using the name.. foobar.
The script runs fine using "bash foobar" or "./foobar" or "sh foobar" or specifying the full complete path. /home/jbanks/foobar and of course putting the file in the /bin directory allows me to run the script by name "foobar"
Buttttt...I wanted to have the ability to exe the script from within my home directory by script name.
On the tutorial they said to just create a /bin directory inside my home directory and move the script into that directory. Done.
Logout then log back in. This is where I'm a little confused. It works....now but when I look at echo $PATH I now have 2 same path statements.. I didn't have to do anything to the .bash_profile either.
This was my path before creating the /bin directory:
[jbanks@localhost jbanks]$ echo $PATH
/usr/X11R6/bin:/usr/local/bin:/bin:/usr/bin
AFTER
[jbanks@localhost jbanks]$ echo $PATH
/bin:/usr/bin:/usr/bin/X11:/usr/X11R6/bin:/usr/local/bin:/usr/bin:/usr/games:/home/jbanks/bin:/home/jbanks/bin
Why is /home/jbanks/bin listed twice?
When I login as root a notice the same type of similarity:
[root@localhost jbanks]# echo $PATH
/sbin:/usr/sbin:/bin:/usr/bin:/usr/X11R6/bin:/usr/local/bin:/usr/local/sbin
Thanks for your help.
Heres a copy of my .bash_profile and .bashrc. Let me know if you need any futher info?
.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
.BASHRC:
# .bashrc
# User specific aliases and functions
# Source global definitions
if [ -f /etc/bashrc ]; then
. /etc/bashrc
fi
Thanks,