Results 1 to 3 of 3
I'm trying to write general code for finding/modifying a bash script, but the only thing is that it could be in many different places, and I don't want to modify ...
- 06-15-2007 #1Just Joined!
- Join Date
- Jun 2006
- Posts
- 32
How to find absolute path of a command
I'm trying to write general code for finding/modifying a bash script, but the only thing is that it could be in many different places, and I don't want to modify the wrong one.
Say, for example, that I call the command "java", and an exe is sitting in /sbin/ and one is sitting in /usr/sbin/
Is there a command which identifies which the machine is pointing to without looking at a .profile?
- 06-15-2007 #2Code:
which <command>
It is amazing what you can accomplish if you do not care who gets the credit.
New Users: Read This First
- 06-15-2007 #3Linux Guru
- Join Date
- Nov 2004
- Posts
- 6,110
The commands are executed in the order of the $PATH variable
So if I created a script in /home/tom/bin called 'firefox' which launched firefox with some custom switches, it would override the one in /usr/bin .Code:tom@btrprime:~> echo $PATH /home/tom/bin:/usr/local/bin:/usr/bin:/usr/X11R6/bin:/bin:/usr/games:/opt/gnome/bin:/opt/kde3/bin:/usr/lib/jvm/jre/bin:/usr/lib/mit/bin:/usr/lib/mit/sbin tom@btrprime:~>


Reply With Quote