Calling execve bash on bash scripts can't find arguments
Does your script start with the hashbang line? I think that's a must, something like: For example, see the following C program: #include #include char *argv[10] = { "./qq.sh", "file1", NULL }; int main (void) { int rc = execve (argv[0], argv, NULL); printf ("rc = %d\n", rc); return 0; } When this is compiled and run with the following qq.sh file, it outputs rc = -1: when you change the file to: #!/bin/bash echo $1 it outputs: as expected.