我正在为类编写一个赋值,在这个任务中,我们必须为C中的Unix系统构建一个简单的shell接口。我使用的是Ubuntu,当我使用这个命令运行提供的源代码时:
osh> cat shell.c我收到一个错误:
*** omake error: File /home/cameron/cs426/Project1/shell.c: line 11, characters 20-24
unexpected token: string: { 这是我第一次使用osh,所以有人对这个问题有什么想法吗?
这是密码,以防万一。
#include<stdio.h>
#include<unistd.h>
#define MAX_LINE 80 /* 80 chars per line, per command */
int main(void)
{
char *args[MAX_LINE/2 + 1]; /* command line (of 80) has max of 40 arguments */
int should_run = 1;
while(should_run){
printf("osh>");
fflush(stdout);
/**
* After reading user input, the steps are:
* (1) fork a child process
* (2) the child process will invoke execvp()
* (3) if command included &, parent will invoke wait()
*/
}
return 0;
}发布于 2015-02-05 22:01:38
看起来这段代码是用来做一个shell的。你需要做的是:
osh是OMake外壳程序,可能与此分配无关。你给出的代码打印了" osh ",但不是osh。gcc -o shell-that-calls-itself-osh shell.c编译时,-o标志告诉gcc将编译的二进制文件放在哪里。./shell-that-calls-itself-osh运行./将在当前目录中运行代码。https://stackoverflow.com/questions/28353114
复制相似问题