The UNIX and Linux Forums  

Go Back   The UNIX and Linux Forums > Top Forums > Shell Programming and Scripting
.
google unix.com



Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts and shell scripting languages here.

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
Adding default search path for CPP boyanov UNIX for Dummies Questions & Answers 1 09-10-2007 02:46 AM
$PWD shows absolute path vs path w/symbolic links kornshellmaven Shell Programming and Scripting 3 06-13-2007 01:15 PM
vi - replacing a relative path with absolute path in a file Yinzer955i UNIX for Dummies Questions & Answers 2 09-07-2006 12:47 PM
Question about Restricting Search path of FIND to current directory super_duper_guy UNIX for Dummies Questions & Answers 2 10-17-2005 10:10 AM
home directory in search path jpprial UNIX for Dummies Questions & Answers 2 09-11-2001 12:42 AM

Closed Thread
English Japanese Spanish French German Portuguese Italian Dutch Swedish Russian Norwegian Hungarian Hebrew Danish Bulgarian Greek Powered by Powered by Google
 
LinkBack Thread Tools Search this Thread Rate Thread Display Modes
  #1 (permalink)  
Old 12-31-2008
bobban bobban is offline
Registered User
  
 

Join Date: Dec 2008
Posts: 5
PATH directory search order

Hello

I using CygWin and am working on project that requires whereby after I make some code changes and rebuild I have to manually copy the updated files into the install directory to test them. There is a build output directory where these files placed, but the program will not run from there. It is mainly dll files that need updating.

So I thought if I set up my path with the build output directory as the first path my program might search there first, and thereby find the updated dll if there is one.

I tried changing my PATH using the following script something like:

PATH="/cygdrive/d/dev/Builds/BuildOutputDir:.:"

However, no matter what I do my application always seems to use the dll from the install directory if there is one. If I remove the dll from that directory and test by setting a few other directories in the PATH then I can see that the precedence of the directories is working correctly. Just I cannot remove the working directory...

Is what I am trying to do possible? Is what I set my PATH to correct?

Thanks in advance for your help.

Last edited by bobban; 12-31-2008 at 10:36 PM..
  #2 (permalink)  
Old 01-01-2009
jwzumwalt jwzumwalt is offline
Registered User
  
 

Join Date: Aug 2007
Posts: 15
Just a quick comment. I occasionally use cygwin but don't know how close to a real unix shell it is.

1-With a real shell the directories are searched in the order they are found in the path statement.
So PATH="/a:/b/1:etc..." the /a will be looked at first.

2-Dont forget to EXPORT your path! About once a week I work an extra 15min on a problem because I forgot to EXPORT the varaiable.

3-You may not have complete control of the path under Cygwin because MS Win may do some of its own hunting before the Cygwin path statement takes place. You will have to do some quick tests

I hope this helps you consider some options....
JZ
  #3 (permalink)  
Old 01-01-2009
bobban bobban is offline
Registered User
  
 

Join Date: Dec 2008
Posts: 5
Quote:
2-Dont forget to EXPORT your path! About once a week I work an extra 15min on a problem because I forgot to EXPORT the varaiable.
What does EXPORT do?

I have a script: newpath.sh

and in that is the line:

PATH="/cygdrive/d/dev/Builds/BuildOutputDir:.:"

and I run it using the source command:

. newpath.sh

and after that, when I enter "printf $PATH" I can see it has updated. Am I missing something?
  #4 (permalink)  
Old 01-01-2009
jwzumwalt jwzumwalt is offline
Registered User
  
 

Join Date: Aug 2007
Posts: 15
EXPORT allows changes to a variable to be global. If you have a shell opened and you change the path variable, then go to another shell window, the change will not show up. If you EXPORT it, it is like telling UNIX to notify all the programs that there is a new version of that variable.
  #5 (permalink)  
Old 01-01-2009
bobban bobban is offline
Registered User
  
 

Join Date: Dec 2008
Posts: 5
Thanks for that jwzumwalt, I really appreciate your help.
Closed Thread

Bookmarks

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On




All times are GMT -4. The time now is 11:44 PM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited. Language Translations Powered by .
vBCredits v1.4 Copyright ©2007 - 2008, PixelFX Studios
The UNIX and Linux Forums Content Copyright ©1993-2009. All Rights Reserved.Ad Management by RedTyger

Content Relevant URLs by vBSEO 3.2.0