Out of curiosity, I played a little bit in my cygwin and got this (for me surprising) result:
$ cat >test-int.c <<EOF
> #include <stdio.h>
>
> int main(int argc, char **argv)
> {
> printf("sizeof (128): %u\n", sizeof (128));
> printf("sizeof (4294967296): %u\n", sizeof (4294967296));
> printf("sizeof (281474976710656): %u\n", sizeof (281474976710656));
> return 0;
> }
> EOF
$ gcc -std=c11 -o test-int test-int.c
$ ./test-int
sizeof (128): 4
sizeof (4294967296): 8
sizeof (281474976710656): 8
$ bash -xe ./test-int
./test-int: ./test-int: cannot execute binary file
$
After some searching I found it. Actually, you and me stumbled into the same trap...
According to man bash (close to the top):
If arguments remain after option processing, and neither the -c nor the
-s option has been supplied, the first argument is assumed to be the
name of a file containing shell commands.
Having learnt this, I tried:
$ bash -c ./test-int
sizeof (128): 4
sizeof (4294967296): 8
sizeof (281474976710656): 8
$ bash -xec ./test-int
+ ./test-int
sizeof (128): 4
sizeof (4294967296): 8
sizeof (281474976710656): 8
$
Update:
I just realized another trap – the command line arguments. The following sample illustrates this:
$ cat >test-arg.c <<EOF
> #include <stdio.h>
>
> int main(int argc, char **argv)
> {
> for (int i = 0; i < argc; ++i) printf("argv[%d]: '%s'\n", i, argv[i]);
> return 0;
> }
> EOF
$ gcc -std=c11 -o test-arg test-arg.c
$ ./test-arg arg1 arg2 arg3
argv[0]: './test-arg'
argv[1]: 'arg1'
argv[2]: 'arg2'
argv[3]: 'arg3'
$ bash -c ./test-arg arg1 arg2 arg3
argv[0]: './test-arg'
$
So, what? The arguments are lost!
$ bash -xec ./test-arg arg1 arg2 arg3
+ ./test-arg
argv[0]: './test-arg'
$
This time, I found the solution without consulting the man bash:
$ bash -xec "./test-arg arg1 arg2 arg3"
+ ./test-arg arg1 arg2 arg3
argv[0]: './test-arg'
argv[1]: 'arg1'
argv[2]: 'arg2'
argv[3]: 'arg3'
$
To make it one call, the command and the arguments have to be "quoted together".
$ ./test-int.exe) but I cannot when I call it this way:$ bash ./test-int.exegetting exactly your error. 1st guess: I have to provide full path but this didn't help. I'm still trying to find out what happens...