Cygwin bash shell scripts are not executing.

This is a discussion on Cygwin bash shell scripts are not executing. within the Tech Board forums, part of the Community Boards category; I have a short cygwin script shown as follows Code: #!/bin/bash cat > cc.awk << ! { for(i=1;i<NF;i++){ list["$i"]=list["$i"] NR ...

  1. #1
    Ethernal Noob
    Join Date
    Nov 2001
    Posts
    1,901

    Cygwin bash shell scripts are not executing.

    I have a short cygwin script shown as follows
    Code:
    #!/bin/bash
    cat > cc.awk << !
    { for(i=1;i<NF;i++){ list["$i"]=list["$i"] NR "." i } }
    END {for(i in list){ print i "=" list[i] } }
    !
    awk -f cc.awk < Raven.txt | sort > concordance.txt
    rm cc.awk
    It's supposed to run the file Raven.txt through awk and sort the output to the file concordance.txt. But when I try to run the script through cygwin I get

    Code:
    $ ./concord.sh
    : No such file or directoryrdance.txt
    The file redirection commands work great in the shell itself, but once I place them in the shell commands they don't do anything.

  2. #2
    and the hat of wrongness Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    32,656
    Check your line endings in various places.
    The error message is overwriting a previous longer line which ends with "rdance.txt", which is the end of your filename.
    If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
    If at first you don't succeed, try writing your phone number on the exam paper.
    I support http://www.ukip.org/ as the first necessary step to a free Europe.

  3. #3
    Ethernal Noob
    Join Date
    Nov 2001
    Posts
    1,901
    It doesn't complain when i use the ash environment, only when I use bash. I tried to check the line endings but they don't work either.

  4. #4
    Ethernal Noob
    Join Date
    Nov 2001
    Posts
    1,901
    Also, filling the loop doesn't seem to work correctly under cygwin. If I write
    Code:
    { for(i=1;i<NF;i++){ list[$i]=list[$i] NR "." i } }
    I get errors at the $i, but in the tutorials they don't have the quotes around the $is. Not to mention the subscripts don't print when I try to do a for through the indices.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Executing an external shell command
    By g4j31a5 in forum C++ Programming
    Replies: 2
    Last Post: 06-20-2007, 07:47 PM
  2. Cygwin and coLinux
    By Mario F. in forum Tech Board
    Replies: 8
    Last Post: 07-03-2006, 02:00 PM
  3. redirect C output to shell (bash) input
    By deltaxfx in forum C Programming
    Replies: 7
    Last Post: 08-24-2005, 01:55 PM
  4. Bash Shell Scripts
    By jennydarma in forum C Programming
    Replies: 1
    Last Post: 12-13-2002, 04:24 AM
  5. shell scripts?
    By Unregistered in forum Linux Programming
    Replies: 1
    Last Post: 05-06-2002, 05:43 AM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21