tags:

views:

198

answers:

1

Why do I get this in MSYS?

user@lappy1 ~
$ mkdir test
sh: mkdir: command not found

Basic commands like cd and pwd work just fine. What happened to mkdir?

+1  A: 

looks like your $PATH is not set up properly, or your startup sequence is broken. what's the result of echo $PATH? there should be something like .:/usr/local/bin:/mingw/bin:/bin in the beginning. mkdir should be in /bin, so if you have /bin in the PATH, it should work. if there is no mkdir in /bin, check your installation. the PATH is initialized from /etc/profile - look if there is something like export PATH=... in it. /etc/profile is read when bash is invoked as login shell, so also check if bash is started with the --login (-l) option (this usually happens from msys.bat). last, cd and pwd are shell builtin commands, so they work in the shell regardless of any PATH setting.

ax
Good tip. I have a mkdir.exe in /bin and /bin is in my path. Here's the weird part: I have a mkdir directory in /bin!!! I renamed the directory to mkdir.bad. Now, mkdir works again. I have no idea how that happened, but it works now!
User1