The chmod command does not work as expected when using MINGW32

1

The chmod command does not work as expected when using MINGW32 in Windows.

I tested only on Windows 10 64 bit.

$ cat ~/bin/minha-shell
echo "Esta é minha shell"
ls -lat /c/

$ chmod 777 ~/bin/minha-shell

$ ls -lat ~/bin/minha-shell
-rw-r--r-- 1 user Administradores 38 Nov  6 14:08 /c/Users/user//bin/minha-shell

$ minha-shell
sh.exe": minha-shell: command not found

In Linux this works

Any tips?

    
asked by anonymous 06.11.2015 / 15:13

1 answer

2

MINGW works slightly differently than a linux distribution.

It requires a Shebang at the start of the Shell to change the attribute of the file.

$ cat ~/bin/minha-shell
#!/bin/bash
echo "Esta é minha shell"
ls -lat /c/

$ chmod 777 ~/bin/minha-shell

That should work!

    
06.11.2015 / 15:19