Script File Problem - Unix

This is a discussion on Script File Problem - Unix ; I'm using Cygwin (which should operate identical to Linux) to run a script file that will decompress some files, build and then configure them. Problem is, as soon as tries to change the directory it says: : No such file ...

+ Reply to Thread
Results 1 to 4 of 4

Thread: Script File Problem

  1. Script File Problem

    I'm using Cygwin (which should operate identical to Linux) to run a script
    file that will decompress some files, build and then configure them. Problem
    is, as soon as tries to change the directory it says:
    : No such file or directory/usr/local/src/arm-elf-tools

    Here is what the script looks like up to that point:

    #! /bin/sh

    # Variables

    export target=arm-elf
    export prefix=/usr/local/src/arm-elf-tools
    export PATH="$prefix/bin":"$PATH"

    # Unpack

    cd $prefix/srcI can tell you that directory does indeed exist. If I run the
    following from the command line it works fine:

    $ export prefix=/usr/local/src/arm-elf-tools

    User@Inspiron /
    $ echo $prefix
    /usr/local/src/arm-elf-tools

    User@Inspiron /
    $ cd $prefix/src

    User@Inspiron /usr/local/src/arm-elf-tools/src

    But for some reason when it runs this in shell (how do I tell if it is using
    bash?) it doesn't work. I should also note that whenever there is a space in
    the shell script it says:
    : command not found2:

    (i.e. 2 means line number 2)

    Is it normal for bash to cause an error for a blank line in a script? My
    theory is that it isn't using bash for some reason and so it's not
    understanding things properly. Please let a newbie know how to make this
    run.

    Thanks,

    - Brian



  2. Re: Script File Problem

    "Bill Marcum" wrote in message
    news:rukc14-13i.ln1@don.localnet...

    > Looks like it could be a problem with CRs in the script, but you'd
    > think, since Cygwin runs on Windows, it wouldn't have that problem.


    I don't really care about the errors caused by CR's though, just the problem
    that it can't find the right directory. But then maybe this is caused
    because the text file is using Windows text encoding (whatever that one is)
    and not Unix. I'll try making a new script under Linux.

    - Brian



  3. Re: Script File Problem

    On 2006-10-29, Brian Bagnall wrote:
    > "Bill Marcum" wrote in message
    > news:rukc14-13i.ln1@don.localnet...
    >
    >> Looks like it could be a problem with CRs in the script, but you'd
    >> think, since Cygwin runs on Windows, it wouldn't have that problem.

    >
    > I don't really care about the errors caused by CR's though, just the problem
    > that it can't find the right directory. But then maybe this is caused
    > because the text file is using Windows text encoding (whatever that one is)
    > and not Unix. I'll try making a new script under Linux.


    It is possible that the CRs *are* the cause of it not finding the
    right directory. It may be looking for "/path/to/dir\r" instead of
    "/path/to/dir".

    --
    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: Script File Problem

    On Sat, 28 Oct 2006 20:57:44 -0500, Brian Bagnall wrote:

    > I don't really care about the errors caused by CR's though, just the problem
    > that it can't find the right directory.


    In this case its enough if you'll use dos2unix

    Gregory

+ Reply to Thread