跳到正文
Pollex's blog
返回

c语言学习笔记之执行shell命令

为了方便,在bash增加了一个路径,放自己写的一些shell脚本。

但是terminal执行的时候,后面总是有.sh后缀名,感觉怪怪的,现在学习c语言,发现编译后的可执行文件没有后缀名,可以直接执行,所以把shell脚本换成了c语言写的可执行程序,具体替换示例如下:

activity.sh

cd /Users/lipeng/hexo
hexo g -d

activity.c

#include <stdlib.h>

int main()
{
    system("cd /Users/lipeng/hexo && hexo g -d");
}

分享这篇文章:

上一篇
undefined reference to `__android_log_print'解决方法
下一篇
使用scp命令向vps传输文件