1. Trang chủ
  2. » Giáo Dục - Đào Tạo

CS170 Operating Systems

39 1.2K 0

Đang tải... (xem toàn văn)

Tài liệu hạn chế xem trước, để xem đầy đủ mời bạn chọn Tải xuống

THÔNG TIN TÀI LIỆU

CS170 Operating Systems Discussion Section 10/09/09 Issues involved with  Programming a Shell • • • • • Program Execution  Unix I/O File Redirection  Pipes  Signal Steps for shell 1. print a prompt 2. Get the command line 3. Parse the command Command‐name  [parameter] [parameter]  4. Find the file User’s .login file Set path=(.:/bin:/usr/bin) 5. Prepare the parameters 6. Execute the command Fork(), execve() & wait() Exec functions • execl, execv, execlp, execvp • different ways to specify the command line.  – execv() and execvp() provide argument vector • different ways the executable is specified.  – execlp() and execvp() duplicate the actions of the  shell in searching for an executable file with path • use execv() and/or execvp() in your shell I/O Redirection • Your shell must support I/O redirection for  standard input and standard output:  – cat file1  – cat  file1  – cat  file1 

Ngày đăng: 18/10/2015, 23:52

Xem thêm: CS170 Operating Systems

w