Reputation: 81
I am tasked with writing a simple shell along with these three commands: "nl", "head", "chroot"(with no parameters). I've written nl.c and head.c but I don't know where to start with the chroot.c. I've read what chroot does, googled some documentation and to me as a beginner this is complicated.
Any advice on this matter?
Upvotes: 3
Views: 603
Reputation: 288140
chroot
without an argument just prints an error message. You can use printf
for that.
Otherwise, chroot calls chroot
, chdir("/")
and then executes a shell with one of the exec*
functions.
Upvotes: 3