Skip to content

Latest commit

 

History

History
72 lines (40 loc) · 1.44 KB

File metadata and controls

72 lines (40 loc) · 1.44 KB

Shell-Implementation-in-C

tags: GitHub

109-02 NCU CE3002B Operating System

Test Environment

  1. VM: VMware Workstation 16 Player
  2. OS: ubuntu-20.04.2.0-desktop-amd64
  3. Make version: GNU Make 4.2.1 x86_64-pc-linux-gnu

fork.c

argv

-h: Print this help.
-d: Implement fork in default mode.
-c: Implement fork in child first mode.
-p: Implement fork in parent first mode.

./fork -d

./fork -c

./fork -p

shell.c

Usage

Any Linux commands that can execute by exec system call, like execl, execlp, execle, execv, execvp, execvpe.
And include execute infinite pipe |, redirect to file >, >> and also redirect from file <.

cd is not in part of exec, therefore determine in other function.
exit can exit the shell

TAB, up arrow, down arrow, left arrow, right arrow can not work as in the normal terminal.

./shell

ls -a -l

ls -al | tail -7 | head -5 | grep git

ls -al > test.txt > test1.txt

grep git < test.txt < test2.txt

grep git < test.txt < test2.txt > test3.txt