This is a discussion on scripts can't find the pwd within the Linux Administration forums, part of the Linux Forums category; Hi, Is this (hopefully) an old, familiar problem? Sometimes bash scripts can't seem to find files or subdirectories of ...
|
|||||||
| FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
|
|||
|
Hi,
Is this (hopefully) an old, familiar problem? Sometimes bash scripts can't seem to find files or subdirectories of the present working directory. So that, for example, executing a shell script from a particular directory, instead of: for adir in $someSubDirs # a list of subdirectories of the pwd do cd $adir ...this and that... cd .. done I must use: for adir in $someSubDirs do cd ./$adir ### prepended relative pwd ...this and that... cd .. done This behavior most recently caused me problems with NIS installation, affecting the execution of /var/yp/Makefile. This happening in bash, Suse 8.2. Any suggestions? Neil Ferguson |
|
|||
|
On 2005-06-05, Neil Ferguson <nferguson@hotmail.com> wrote:
> cd ./$adir ### prepended relative pwd There should be no different between "cd $dir" and "cd ./$dir". Is the problem reliably reproduceable? Can you create a set of conditions that will trigger it? Can you show us a complete script that demonstrates the problem and the output it produces? -- Lars -- Lars Kellogg-Stedman <jn8g543ro0hu8fr@jetable.net> This email address will expire on 2005-11-21. |
|
|||
|
On 2005-11-14, Lars Kellogg-Stedman wrote:
> On 2005-06-05, Neil Ferguson <nferguson@hotmail.com> wrote: >> cd ./$adir ### prepended relative pwd > > There should be no different between "cd $dir" and "cd ./$dir". There can be if $CDPATH is set. -- Chris F.A. Johnson, author | <http://cfaj.freeshell.org> Shell Scripting Recipes: | My code in this post, if any, A Problem-Solution Approach | is released under the 2005, Apress | GNU General Public Licence |
![]() |
| Thread Tools | |
| Display Modes | |
|
|