Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Linking update programs

Status
Not open for further replies.

ronfarris

Programmer
Oct 25, 2000
30
US
Hi:
I waas wondering how you go about linking new programs so that they will run rather the old program?
Thank you in advance.
Ron
 
Hi Ron,

You probably don't need to bother with linking and such.

In UNIX the $PATH variable is the key to knowing which version of an executable program or script will be run.

$PATH is a ':' separated list of directories. When you type a command at the shell prompt this list of directories is searched until a matching executable file is found or the end of the list is run. Unlike DOS and Winxx the current directory is *not* searched unless it is included in $PATH.

So -- let's say you have a program called "my_prog" and you want to install version 2 of my_prog, so that version 2 will run rather than the current version.

At the shell prompt -- type:

whence my_prog

This command will search $PATH for you until it finds an executable version of my_prog -- it won't run my_prog though, it will just print out the full path of the first match it finds. Let's say your shell session looks like this:

$ whence my_prog
/usr/local/bin/my_prog
$

This means that the file "my_prog" in the directory /usr/local/bin will be executed when you type "my_prog" at the shell prompt.

To replace that version of my_prog, copy the new version over the top of it -- if the new version is stored in /usr/new_vers/my_prog the command to do that would look like this:

cp /usr/new_vers/my_prog /usr/local/bin/my_prog
Mike
michael.j.lacey@ntlworld.com
Email welcome if you're in a hurry or something -- but post in tek-tips as well please, and I will post my reply here as well.
 
Thank you MikeLacey, but I need to link the program as I am not allowed to delete stuff or copy it over. Any ideas?
Thank you again!
Ron
 
Ron,

Talk to your sysadmin again -- what you need to do is quite reasonable. There's no reason you shouldn't be able to get work like this done.

Mike
michael.j.lacey@ntlworld.com
Email welcome if you're in a hurry or something -- but post in tek-tips as well please, and I will post my reply here as well.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top