I have a question about lab1 of 6.s081

Background

Lab: Xv6 and Unix utilities (mit.edu)

Pasted image 20240807154852
Pasted image 20240807154904
Pasted image 20240807154939

Problem Description

It seems my exec isn’t working? The arguments should be passed correctly (they can be printed on the command line), and running the command directly in the shell produces the correct output (hello), but when passed to exec there is no output. What could be the cause? Thanks everyone.

69c38bd9a2ea5e6547a05959961dc8a6

Source Code

xargs.c (2.4 KB)

Resolved, the problem was in how I passed the argument array to exec; for example, when exec-ing a grep program, the argument array (i.e., the args in the code) should have its first element be grep.