Browse Source

commit files

master
杨浩然 3 years ago
parent
commit
db0d8aefd2
17 changed files with 349 additions and 4 deletions
  1. +77
    -1
      README.md
  2. BIN
      lab_report/1 Shell.doc
  3. +0
    -0
      lab_report/project-1.pdf
  4. BIN
      lab_report/structure.xmind
  5. BIN
      lab_report/test_case_img/cd.png
  6. BIN
      lab_report/test_case_img/exit.png
  7. BIN
      lab_report/test_case_img/history.png
  8. BIN
      lab_report/test_case_img/ls.png
  9. BIN
      lab_report/test_case_img/mytop.png
  10. BIN
      lab_report/test_case_img/pipe.png
  11. BIN
      lab_report/test_case_img/redirect_in.png
  12. BIN
      lab_report/test_case_img/redirect_out.png
  13. BIN
      lab_report/test_case_img/vi.png
  14. BIN
      lab_report/test_case_img/vi_bg.png
  15. +269
    -0
      lab_report/yeeshell.svg
  16. +3
    -3
      yeeshell.c

+ 77
- 1
README.md View File

@ -1,3 +1,79 @@
# OS2021_Project1.Shell # OS2021_Project1.Shell
OS2021_Project1.Shell
###
#### yeeshell.c
main function and function definition
#### yeeshell.h
function declaration and macro definition
###
### 1. Deployment
Pull from my shuishan git.
```shell
git clone root@gitea.shuishan.net.cn:10195501441/OS2021_Project1.Shell.git
```
In the **MINIX3** environment, use clang to compile the program.
```shell
clang yeeshell.c -o yeeshell
```
Run yeeshell.
```shell
./yeeshell
```
### 2. Test Case
​ (1) `cd /your/path`
<img src="E:\undergraduate\sophomore\SEM2\OS\experiments\1 Shell\OS2021_Project1.Shell\lab_report\test_case_img\cd.png" alt="cd" style="zoom: 76%;" />
​ (2) `ls -a -l`
<img src="E:\undergraduate\sophomore\SEM2\OS\experiments\1 Shell\OS2021_Project1.Shell\lab_report\test_case_img\ls.png" alt="ls" style="zoom:76%;" />
​ (3) `ls -a -l > result.txt`
<img src="E:\undergraduate\sophomore\SEM2\OS\experiments\1 Shell\OS2021_Project1.Shell\lab_report\test_case_img\redirect_out.png" alt="redirect_out" style="zoom:76%;" />
​ (4) `vi result.txt`
<img src="E:\undergraduate\sophomore\SEM2\OS\experiments\1 Shell\OS2021_Project1.Shell\lab_report\test_case_img\vi.png" alt="vi" style="zoom:76%;" />
​ (5) `grep a < result.txt`
<img src="E:\undergraduate\sophomore\SEM2\OS\experiments\1 Shell\OS2021_Project1.Shell\lab_report\test_case_img\redirect_in.png" alt="redirect_in" style="zoom:76%;" />
​ (6) `ls -a -l | grep a `
<img src="E:\undergraduate\sophomore\SEM2\OS\experiments\1 Shell\OS2021_Project1.Shell\lab_report\test_case_img\pipe.png" alt="pipe" style="zoom:76%;" />
​ (7) `vi result.txt`
​ This command can not be executed in the **MINIX3** environment. It prints the following error information.
<img src="E:\undergraduate\sophomore\SEM2\OS\experiments\1 Shell\OS2021_Project1.Shell\lab_report\test_case_img\vi_bg.png" alt="vi_bg" style="zoom:76%;" />
​ (8) `mytop `
<img src="E:\undergraduate\sophomore\SEM2\OS\experiments\1 Shell\OS2021_Project1.Shell\lab_report\test_case_img\mytop.png" alt="mytop" style="zoom:76%;" />
​ (9) `history n`
<img src="E:\undergraduate\sophomore\SEM2\OS\experiments\1 Shell\OS2021_Project1.Shell\lab_report\test_case_img\history.png" alt="history" style="zoom:76%;" />
​ (10) `exit`
<img src="E:\undergraduate\sophomore\SEM2\OS\experiments\1 Shell\OS2021_Project1.Shell\lab_report\test_case_img\exit.png" alt="exit" style="zoom:76%;" />

BIN
lab_report/1 Shell.doc View File


project-1.pdf → lab_report/project-1.pdf View File


BIN
lab_report/structure.xmind View File


BIN
lab_report/test_case_img/cd.png View File

Before After
Width: 1230  |  Height: 68  |  Size: 7.5 KiB

BIN
lab_report/test_case_img/exit.png View File

Before After
Width: 1230  |  Height: 67  |  Size: 3.9 KiB

BIN
lab_report/test_case_img/history.png View File

Before After
Width: 1230  |  Height: 338  |  Size: 12 KiB

BIN
lab_report/test_case_img/ls.png View File

Before After
Width: 1230  |  Height: 273  |  Size: 29 KiB

BIN
lab_report/test_case_img/mytop.png View File

Before After
Width: 1230  |  Height: 101  |  Size: 13 KiB

BIN
lab_report/test_case_img/pipe.png View File

Before After
Width: 1230  |  Height: 305  |  Size: 34 KiB

BIN
lab_report/test_case_img/redirect_in.png View File

Before After
Width: 1230  |  Height: 305  |  Size: 34 KiB

BIN
lab_report/test_case_img/redirect_out.png View File

Before After
Width: 1230  |  Height: 340  |  Size: 37 KiB

BIN
lab_report/test_case_img/vi.png View File

Before After
Width: 1230  |  Height: 779  |  Size: 39 KiB

BIN
lab_report/test_case_img/vi_bg.png View File

Before After
Width: 1230  |  Height: 65  |  Size: 6.3 KiB

+ 269
- 0
lab_report/yeeshell.svg
File diff suppressed because it is too large
View File


+ 3
- 3
yeeshell.c View File

@ -251,10 +251,10 @@ int do_pipe(char **pipe_arg_1, char **pipe_arg_2)
} }
} }
if ((prog_2 = fork()) == 0) /* Child process 1 */
if ((prog_2 = fork()) == 0) /* Child process 2 */
{ {
dup2(fds[0], 0);
close(0);
dup2(fds[0]);
close(fds[0]); close(fds[0]);
close(fds[1]); close(fds[1]);

Loading…
Cancel
Save