Bash – cygwin, PATH problem

bashcygwin

I run a .ksh containing a awk call. awk.exe and his shortcut awk is in /bin/awk, /bin is in the PATH environment variable. But when I try to launch awk, I have this error message :

bash: /usr/bin/awk: no such file or directory

Why didn't bash look for it in the /bin folder too?

edit : tar has the same rights, tar.exe is in /bin and can be listed in /usr/bin/, the exact same way than awk. Tar works fine whereas awk not.

Best Answer

Does the ksh script explicitly define the path to awk? It could be via a variable ( AWK=/usr/bin/awk, invoked by $AWK). Try running which awk and alias awk, too.

Edit

Cygwin install process actually sets up /usr/bin as a hardlink to /bin. (Do ls -li /usr/ and ls -li / and you'll see the bin folders have the same inode number. Also, browse to the /usr/bin folder in windows explorer and you'll see it's empty.)

Your PATH is probably fine, but probably has /usr/bin before /bin, so it's finding awk via that route first.

Looking at your previous question, I think you might have a similar, shortcut related issue here. I tried renaming my awk.exe to dawk.exe in windows and then set up a shortcut called awk.exe pointing to it. Running awk then gives me the same error you can see. I had to force that issue, though; I think your Cygwin installation might be a bit broken, but it's hard to say how. Do you get similar errors from any other binaries?