scripts can't find the pwd - Linux

This is a discussion on scripts can't find the pwd - Linux ; 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 ...

+ Reply to Thread
Results 1 to 4 of 4

Thread: scripts can't find the pwd

  1. scripts can't find the pwd

    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




  2. Re: scripts can't find the pwd

    On 2005-06-05, Neil Ferguson 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
    This email address will expire on 2005-11-21.


  3. Re: scripts can't find the pwd

    On 2005-11-14, Lars Kellogg-Stedman wrote:
    > On 2005-06-05, Neil Ferguson 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 |
    Shell Scripting Recipes: | My code in this post, if any,
    A Problem-Solution Approach | is released under the
    2005, Apress | GNU General Public Licence

  4. Re: scripts can't find the pwd

    > There can be if $CDPATH is set.

    Good catch.

    -- Lars

    --
    Lars Kellogg-Stedman <1o4ibj70m3vooae@jetable.org>
    This email address will expire on 2005-11-22.


+ Reply to Thread