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.


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.


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?

  • /usr/bin/awk with which, awk not found with alias command – jayjaypg22 Dec 9 '10 at 16:11
  • Even with the variable in the .ksh I 've got the error message : /usr/bin/sh: /usr/bin/awk: No such file or directory – jayjaypg22 Dec 9 '10 at 16:18
  • I've just remembered something about Cywgin. I'll edit my post. – SmallClanger Dec 10 '10 at 10:45

You should try an echo $PATH when you are in the korn shell. It will tell you the search path that is being used to find programs.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.