例如,如果我的文件 hello.c 只包含:
int main() {
printf("Hello world");
return 0;
}
Run Code Online (Sandbox Code Playgroud)
我在 gcc 中构建了它,gcc hello.c -o hello
然后我可以运行./hello
它并运行。
但是,如果我尝试使用 eg 从网络下载二进制文件,则curl
必须先使用 chmod 设置权限,然后才能运行它。有什么原因吗?gcc 和/或 curl 是否为文件设置了一些默认权限?