delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/1997/01/02/13:01:42

From: franl AT world DOT std DOT com (Francis Litterio)
Subject: How do I get bash to run shell scripts?
2 Jan 1997 13:01:42 -0800 :
Sender: daemon AT cygnus DOT com
Approved: cygnus DOT gnu-win32 AT cygnus DOT com
Distribution: cygnus
Message-ID: <199701021918.AA01570.cygnus.gnu-win32@world.std.com>
Original-To: gnu-win32 AT cygnus DOT com
Original-Sender: owner-gnu-win32 AT cygnus DOT com

I'm using the 17.1 release, and bash refuses to execute scripts that
are definitely in my PATH.  Here's what I see:

    bash$ mount
    Device           Directory           Type        Flags
    c:\temp          /tmp                native      no-mixed,text!=binary
    \\.\tape1:       /dev/st1            native      no-mixed,text!=binary
    \\.\tape0:       /dev/st0            native      no-mixed,text!=binary
    \\.\b:           /dev/fd1            native      no-mixed,text!=binary
    \\.\a:           /dev/fd0            native      no-mixed,text!=binary
    c:\APPS\cw\H-i386-cygwin32\bin /bin  native      no-mixed,text!=binary
    c:               /                   native      no-mixed,text!=binary
    bash$ echo $PATH
    /franl/bin:/bin:/WINNT/system32:/WINNT:/dos
    bash$ pwd
    /franl
    bash$ cat > bin/bletch
    #!/bin/sh
    echo hello
    ^Z
    bash$ chmod +x bin/bletch
    bash$ hash -r
    bash$ which bletch
    bletch is /franl/bin/bletch
    bash$ ls -l bin/bletch
    -rwxr-xr-x   1 500      everyone       23 Jan 02 13:59 bin/bletch
    bash$ bin/bletch
    hello
    bash$ /franl/bin/bletch
    hello
    bash$ type bletch
    bletch is hashed (/franl/bin/bletch)
    bash$ bletch
    bletch: bletch: No such file or directory

It knows the script is there, because it hashed its path, but it will
not execute it when given just the script name.  I even tried changing
the "#!/bin/sh" to "#!/bin/sh.exe", but that didn't help.  Ordinary
..exe's work fine:

    bash$ pwd
    /franl
    bash$ cp /bin/ls.exe bin/goo.exe
    bash$ goo -l bin/goo.exe
    -rwxr-xr-x   1 500      everyone    51200 Jan 02 14:11 bin/goo.exe

Oddly, if I cd into my bin directory, it works (even though . is not
in my path):

    bash$ cd bin
    bash$ pwd
    /franl/bin
    bash$ bletch
    hello

Has anyone seen this before?  Anyone know what to do about it?
Running shell scripts is a pretty basic part of the whole UNIX thing,
so I feel crippled without it.
-- 
Francis Litterio                     PGP Key Fingerprint:
franl AT world DOT std DOT com                  02 37 DF 6C 66 43 CD 2C
http://world.std.com/~franl/         10 C8 B5 8B 57 34 F3 21

-
For help on using this list, send a message to
"gnu-win32-request AT cygnus DOT com" with one line of text: "help".

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019