cygwin's chmod behaves as working, but it does not work
Kudos to this answer https://stackoverflow.com/questions/25730041/updating-file-permissions-with-git-bash-on-windows-7 contents pasted below
You are probably using NTFS or FAT32 on Windows, and those filesystems do not support the executable permission. Instead, cygwin looks at the file name and contents to determine whether it's executable:
Files are considered to be executable if the filename ends with .bat, .com or .exe, or if its content starts with #!.
So you should make sure that the bash file starts with a shebang. Then, you should be able to just execute the file, disregarding the permission output of ls
.
I was unable to chmod until I found that /etc/fstab contained:
none /cygdrive cygdrive binary,noacl,posix=0,user 0 0
but needed to be:
none /cygdrive cygdrive binary,posix=0,user 0 0
After closing all open Cygwin processes and restarting, all worked.
I found This Answer helpful.
Besides normal POSIX permissions that contoll owner, group, other access, the file permission in Cygwin may also be affected by Windows ACL.
In your case, please try
ls -l /tmp/example.sh
getfacl /tmp/example.sh
setfacl -b /tmp/example.sh
ls -l /tmp/example.sh
chmod -v +x /tmp/example.sh
ls -l /tmp/example.sh
Just add #!/bin/bash
in the first line of the script,
but it is important to do it with nano or vi .
After saving - the file will showed as green, with executable permission.
see image for example :