?? project1.htm
字號:
line is called a <I style="mso-bidi-font-style: normal">job</I>. </SPAN></P>
<P class=MsoNormal style="MARGIN-LEFT: 36pt"><SPAN lang=EN-US><![if !supportEmptyParas]> <![endif]><o:p></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN-LEFT: 36pt"><SPAN lang=EN-US>When executing
backgrounds jobs, the shell should not wait for the job to finish before
prompting, reading, and processing the next command. When a background job
finally terminates a message to that effect must be printed, by the shell, to
the terminal. This message should be printed as soon as the job
terminates.</SPAN></P>
<P class=MsoNormal style="MARGIN-LEFT: 36pt"><SPAN lang=EN-US><![if !supportEmptyParas]> <![endif]><o:p></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN-LEFT: 36pt"><SPAN lang=EN-US>The syntax for
doing this will be described in the section of this document describing the
shell’s parser.</SPAN></P>
<P class=MsoNormal style="MARGIN-LEFT: 36pt"><SPAN lang=EN-US><![if !supportEmptyParas]> <![endif]><o:p></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN-LEFT: 36pt"><SPAN lang=EN-US>Your parser should
also support several <I style="mso-bidi-font-style: normal">internal
commands</I> these commands, if issued by the user, should direct the shell to
take a particular action itself instead of directing it to execute other
programs. The details of this are discussed in the section describing internal
commands. </SPAN></P>
<P class=MsoNormal style="MARGIN-LEFT: 36pt"><SPAN lang=EN-US><![if !supportEmptyParas]> <![endif]><o:p></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN-LEFT: 36pt"><SPAN lang=EN-US><![if !supportEmptyParas]> <![endif]><o:p></o:p></SPAN></P>
<H4><SPAN lang=EN-US>Foreground vs. Background Jobs</SPAN></H4>
<P class=MsoNormal style="MARGIN-LEFT: 36pt"><SPAN lang=EN-US><![if !supportEmptyParas]> <![endif]><o:p></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN-LEFT: 36pt"><SPAN lang=EN-US>Your shell should
be capable of executing both foreground and background jobs. Whereas your shell
should wait for foreground jobs to complete before continuing, it should
immediately continue, prompt the user, &c, after placing a job into the
background.</SPAN></P>
<H4><SPAN
lang=EN-US><![if !supportEmptyParas]> <![endif]><o:p></o:p></SPAN></H4>
<H4><SPAN lang=EN-US>Command lines</SPAN></H4>
<P class=MsoNormal style="MARGIN-LEFT: 36pt"><B
style="mso-bidi-font-weight: normal"><SPAN
lang=EN-US><![if !supportEmptyParas]> <![endif]><o:p></o:p></SPAN></B></P>
<P class=MsoNormal style="MARGIN-LEFT: 36pt"><SPAN lang=EN-US>When the user
responds to a prompt, what they type composes a <I
style="mso-bidi-font-style: normal">command line string</I>. </SPAN></P>
<P class=MsoNormal style="MARGIN-LEFT: 36pt"><SPAN lang=EN-US><![if !supportEmptyParas]> <![endif]><o:p></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN-LEFT: 36pt"><SPAN lang=EN-US>Your shell should
store each command-line string, until the job is finished executing. This
includes both background and suspended jobs.</SPAN></P>
<P class=MsoNormal style="MARGIN-LEFT: 36pt"><SPAN lang=EN-US><![if !supportEmptyParas]> <![endif]><o:p></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN-LEFT: 36pt"><SPAN lang=EN-US>The shell should
assign each command-line string a non-negative integer identifier. The data
structure used to store the jobs should allow access to each element using this
identifier. Once the actions directed by a command-line string are completed,
your shell should remove it from the data structure. Identifiers can be recycled
if you choose. Please note that this data structure should keep track of whole
command line strings, not just the names of the individual tasks that may
compose them.</SPAN></P>
<P class=MsoNormal style="MARGIN-LEFT: 36pt"><SPAN lang=EN-US><![if !supportEmptyParas]> <![endif]><o:p></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN-LEFT: 36pt"><SPAN lang=EN-US>You should not
keep track of command line strings that contain internal commands, since, by
their nature, they will complete before this information could become
useful.</SPAN></P>
<P class=NormalWeb><SPAN
lang=EN-US><![if !supportEmptyParas]> <![endif]><o:p></o:p></SPAN></P>
<P class=NormalWeb style="TEXT-INDENT: 36pt"><B
style="mso-bidi-font-weight: normal"><SPAN lang=EN-US>Internal
Commands<o:p></o:p></SPAN></B></P>
<P class=NormalWeb><SPAN
lang=EN-US><![if !supportEmptyParas]> <![endif]><o:p></o:p></SPAN></P>
<P class=NormalWeb style="MARGIN-LEFT: 36pt"><SPAN lang=EN-US>The following are
the internal commands. If an internal command is submitted by the user, the
shell should take the described actions itself.<SPAN
style="mso-spacerun: yes"> </SPAN></SPAN></P>
<P class=NormalWeb><SPAN
lang=EN-US><![if !supportEmptyParas]> <![endif]><o:p></o:p></SPAN></P>
<P class=MsoNormal
style="MARGIN-LEFT: 54pt; TEXT-INDENT: -18pt; mso-list: l3 level1 lfo5; tab-stops: list 54.0pt"><![if !supportLists]><SPAN
lang=EN-US
style="FONT-FAMILY: Symbol; mso-fareast-font-family: 'Times New Roman'">·<SPAN
style="FONT: 7pt 'Times New Roman'">
</SPAN></SPAN><![endif]><SPAN class=HTMLTypewriter><B
style="mso-bidi-font-weight: normal"><SPAN lang=EN-US
style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-bidi-font-family: 黑體">exit</SPAN></B></SPAN><SPAN
lang=EN-US>: Kill all child processes and exit ysh with a meaningful return
code.<SPAN style="mso-spacerun: yes"> </SPAN></SPAN></P>
<P class=MsoNormal
style="MARGIN-LEFT: 54pt; TEXT-INDENT: -18pt; mso-list: l3 level1 lfo5; tab-stops: list 54.0pt"><![if !supportLists]><SPAN
lang=EN-US
style="FONT-FAMILY: Symbol; mso-fareast-font-family: 'Times New Roman'">·<SPAN
style="FONT: 7pt 'Times New Roman'">
</SPAN></SPAN><![endif]><SPAN class=HTMLTypewriter><B
style="mso-bidi-font-weight: normal"><SPAN lang=EN-US
style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-bidi-font-family: 黑體">jobs</SPAN></B></SPAN><SPAN
lang=EN-US>: Print out the command line strings for jobs that are currently
executing in the background and jobs that are currently suspended, as well as
the identifier associated with each command line string. You may format the
output of this command in way that is convenient to the user. Please remember
that jobs itself is an internal command and consequently should not appear in
the output. </SPAN></P>
<P class=MsoNormal
style="MARGIN-LEFT: 54pt; TEXT-INDENT: -18pt; mso-list: l3 level1 lfo5; tab-stops: list 54.0pt"><![if !supportLists]><SPAN
lang=EN-US
style="FONT-FAMILY: Symbol; mso-fareast-font-family: 'Times New Roman'">·<SPAN
style="FONT: 7pt 'Times New Roman'">
</SPAN></SPAN><![endif]><SPAN class=HTMLTypewriter><B
style="mso-bidi-font-weight: normal"><SPAN lang=EN-US
style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-bidi-font-family: 黑體">echo
$status</SPAN></B></SPAN><SPAN lang=EN-US>: Prints the exit status of the most
recent foreground child process to have exited. Return 0 if no such child has
existed. </SPAN></P>
<P class=MsoNormal
style="MARGIN-LEFT: 54pt; TEXT-INDENT: -18pt; mso-list: l3 level1 lfo5; tab-stops: list 54.0pt"><![if !supportLists]><SPAN
lang=EN-US
style="FONT-FAMILY: Symbol; mso-fareast-font-family: 'Times New Roman'">·<SPAN
style="FONT: 7pt 'Times New Roman'">
</SPAN></SPAN><![endif]><SPAN class=HTMLTypewriter><B
style="mso-bidi-font-weight: normal"><SPAN lang=EN-US
style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-bidi-font-family: 黑體">fg
%<int></SPAN></B></SPAN><SPAN lang=EN-US>: Brings the job identified by
<int> into the foreground. If this job was previously stopped, it should
now be running. Your shell should wait for a foregound child to terminate before
returning a command prompt or taking any other action.</SPAN></P>
<P class=MsoNormal
style="MARGIN-LEFT: 54pt; TEXT-INDENT: -18pt; mso-list: l3 level1 lfo5; tab-stops: list 54.0pt"><![if !supportLists]><SPAN
lang=EN-US
style="FONT-FAMILY: Symbol; mso-fareast-font-family: 'Times New Roman'">·<SPAN
style="FONT: 7pt 'Times New Roman'">
</SPAN></SPAN><![endif]><SPAN class=HTMLTypewriter><B
style="mso-bidi-font-weight: normal"><SPAN lang=EN-US
style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-bidi-font-family: 黑體">bg
%<int></SPAN></B></SPAN><SPAN lang=EN-US>: Execute the suspended job
identified by <int> in the background.</SPAN></P>
<P class=MsoNormal
style="MARGIN-LEFT: 54pt; TEXT-INDENT: -18pt; mso-list: l3 level1 lfo5; tab-stops: list 54.0pt"><![if !supportLists]><SPAN
lang=EN-US
style="FONT-FAMILY: Symbol; mso-fareast-font-family: 'Times New Roman'">·<SPAN
style="FONT: 7pt 'Times New Roman'">
</SPAN></SPAN><![endif]><SPAN class=HTMLTypewriter><SPAN lang=EN-US
style="mso-ansi-font-size: 12.0pt; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">Internal
commands can take advantage of piped I/O, execute in the background, &c, as
appropriate</SPAN></SPAN><SPAN lang=EN-US>. </SPAN></P>
<P class=MsoNormal><SPAN class=HTMLTypewriter><B
style="mso-bidi-font-weight: normal"><SPAN lang=EN-US
style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-bidi-font-family: 黑體"><![if !supportEmptyParas]> <![endif]><o:p></o:p></SPAN></B></SPAN></P>
<P class=MsoNormal style="MARGIN-LEFT: 36pt"><SPAN lang=EN-US> </SPAN></P>
<H5><SPAN lang=EN-US>Special Keystrokes</SPAN></H5>
<P class=MsoNormal><SPAN
lang=EN-US><![if !supportEmptyParas]> <![endif]><o:p></o:p></SPAN></P>
<P class=MsoBodyTextIndent><SPAN lang=EN-US>Through an interaction with the
terminal driver, certain combinations of keystrokes will generate signals to
your shell instead of appearing within stdin. Your shell should respond
appropriately to these signals. </SPAN></P>
<P class=MsoNormal><SPAN
lang=EN-US><![if !supportEmptyParas]> <![endif]><o:p></o:p></SPAN></P>
<P class=MsoNormal
style="MARGIN-LEFT: 54pt; TEXT-INDENT: -18pt; mso-list: l3 level1 lfo5; tab-stops: list 54.0pt"><![if !supportLists]><SPAN
lang=EN-US
style="FONT-FAMILY: Symbol; mso-fareast-font-family: 'Times New Roman'">·<SPAN
style="FONT: 7pt 'Times New Roman'">
</SPAN></SPAN><![endif]><SPAN lang=EN-US>Control-Z generates a SIGSTOP. This
should not cause your shell to be suspended. Instead, it should cause your shell
to suspend the processes in the current foreground job. If there is no
foreground job, it should have no effect.</SPAN></P>
<P class=MsoNormal
style="MARGIN-LEFT: 54pt; TEXT-INDENT: -18pt; mso-list: l3 level1 lfo5; tab-stops: list 54.0pt"><![if !supportLists]><SPAN
lang=EN-US
style="FONT-FAMILY: Symbol; mso-fareast-font-family: 'Times New Roman'">·<SPAN
style="FONT: 7pt 'Times New Roman'">
</SPAN></SPAN><![endif]><SPAN lang=EN-US>Control-C generates a SIGINT. This
should not kill your shell. Instead it should cause your shell to kill the
processes in the current foreground job. If there is no foreground job, it
should have no effect. </SPAN></P>
<P class=MsoNormal><SPAN
lang=EN-US><![if !supportEmptyParas]> <![endif]><o:p></o:p></SPAN></P>
<H5><SPAN lang=EN-US>Parsing User Input – Overview, Delimiters and Special
Characters</SPAN></H5>
<P class=MsoNormal><SPAN
lang=EN-US><![if !supportEmptyParas]> <![endif]><o:p></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN-LEFT: 36pt"><SPAN lang=EN-US>Your parser for
user input should be capable of accepting input from the user as described in
this section. It should also detect improper input from the user. If the user
enters something improper, your shell should produce a meaningful error
message.</SPAN></P>
<P class=MsoNormal style="MARGIN-LEFT: 36pt"><SPAN lang=EN-US><![if !supportEmptyParas]> <![endif]><o:p></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN-LEFT: 36pt"><SPAN lang=EN-US>Just like
commercial-grade shells, your shell should accept input from the user one line
at a time. You should begin parsing the users input when he/she hits enter.
Empty command lines should be treated as no-ops and yield a new prompt.
</SPAN></P>
<P class=MsoNormal style="MARGIN-LEFT: 36pt"><SPAN lang=EN-US><![if !supportEmptyParas]> <![endif]><o:p></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN-LEFT: 36pt"><SPAN lang=EN-US>Blank-space
characters should be treated as delimiters, but your shell should be insensitive
to repeated blank spaces. It should also be insensitive to blank spaces at the
beginning or end of the command line. </SPAN></P>
<P class=MsoNormal style="MARGIN-LEFT: 36pt"><SPAN lang=EN-US><![if !supportEmptyParas]> <![endif]><o:p></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN-LEFT: 36pt"><SPAN lang=EN-US>Certain
characters, known as <I style="mso-bidi-font-style: normal">meta-characters</I>,
?? 快捷鍵說明
復(fù)制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -