The chmod command does not work as expected when using MINGW32

Asked

Viewed 585 times

1

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

I tested only on Windows 10 64 bits.

$ 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

On Linux this works

Any hint ?

1 answer

2


MINGW works slightly differently than a linux distribution.

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

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

$ chmod 777 ~/bin/minha-shell

That should work !

Browser other questions tagged

You are not signed in. Login or sign up in order to post.