Skip to content

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 

Repository files navigation

OS 2024 Lab 2 - Shell Implementation 作業紀錄

本作業實作一個簡易 Shell 程式。支援 built-in 指令與 external command,並實作 I/O redirection 以及 pipe 。

Requirement 2.1 - Built-in command cd

  • 實作於 builtin.c 中的 cd()
  • 支援輸入路徑作為參數,未輸入時顯示錯誤訊息

Requirement 2.2 - External command

  • 實作於 spawn_proc()shell.c
  • 使用 fork() 建立 Child Process
  • Child Process 中使用 execvp() 執行外部指令
  • Parent Process 使用 waitpid() 等待完成

Requirement 2.3 - Redirection <>

  • 實作於 redirection()shell.c
  • 輸入檔案使用 open() 並以 dup2() 取代 stdin
  • 輸出檔案使用 open() 並以 dup2() 取代 stdout

Requirement 2.4 - Pipe(加分題)

  • 實作於 fork_cmd_node() 函式
  • 每個指令透過 spawn_proc() 呼叫

About

作業系統Lab2: shell

Resources

Stars

Watchers

Forks

Releases

Packages

Contributors

Languages