diff options
| author | Robert Morris <rtm@csail.mit.edu> | 2019-07-26 04:53:59 -0400 | 
|---|---|---|
| committer | Robert Morris <rtm@csail.mit.edu> | 2019-07-26 04:53:59 -0400 | 
| commit | 8d30e21b59d2f6d48e593cd6c2399d0743971155 (patch) | |
| tree | 6e069363f4841813a5c2af0455375fe3f0090ff3 /labs/xv6.html | |
| parent | ea95a6654c3f921849f3541aa856a8806ebf571e (diff) | |
| parent | 0358ee912bb37439d36a76ca4469aaa1ab6c2a48 (diff) | |
| download | xv6-labs-8d30e21b59d2f6d48e593cd6c2399d0743971155.tar.gz xv6-labs-8d30e21b59d2f6d48e593cd6c2399d0743971155.tar.bz2 xv6-labs-8d30e21b59d2f6d48e593cd6c2399d0743971155.zip | |
Merge branch 'riscv' of g.csail.mit.edu:xv6-dev into riscv
Diffstat (limited to 'labs/xv6.html')
| -rw-r--r-- | labs/xv6.html | 56 | 
1 files changed, 50 insertions, 6 deletions
| diff --git a/labs/xv6.html b/labs/xv6.html index fcbb234..8dc7786 100644 --- a/labs/xv6.html +++ b/labs/xv6.html @@ -109,7 +109,7 @@ initial file system.  You just ran one of them: <tt>ls</tt>.        $ make qemu        ...        init: starting sh -      $ sleep 5 +      $ sleep 10        (waits for a little while)        $      </pre> @@ -178,16 +178,60 @@ initial file system.  You just ran one of them: <tt>ls</tt>.      <li>Don't recurse into "." and "..".    </ul> -<h2>Optional: modify the shell</h2> +<p>Optional: support regular expressions in name matching.  Grep has some +  primitive support for regular expressions. +   +<h2>xargs</h2> -<p>Modify the shell to support wait. +<p>Write a simple version of the UNIX xargs program: read lines from +  standard in and run a command for each line, supplying the line as +  arguments to the command.  The following example illustrates xarg's +  behavior: +  <pre> +    $ xargs echo bye +    hello too +    bye hello too +    <ctrl-d> +    $ +  </pre> +  Note that the command here is "echo bye" and the additional +  arguments are "hello too", making the command "echo bye hello too", +  which outputs "bye hello too". -<p>Modify the shell to support lists of commands, separated by ";" +<p>xargs and find combine well: +  <pre> +    find . b | xargs grep hello +  </pre> +  will run "grep hello" on each file named b in the directories below ".". + +<p>Some hints: +  <ul> +    <li>Use <tt>fork</tt> and <tt>exec</tt> system call to invoke the +      command on each line of input.  Use <tt>wait</tt> in the parent +      to wait for the child to complete running the command. +    <li>Read from stdin a character at the time until the newline +      character ('\n'). +    <li>kernel/param.h declares MAXARG, which may be useful if you need +    to declare an argv. +  </ul> -<p>Modify the shell to support sub-shells by implementing "(" and ")" +<h2>Optional: modify the shell</h2> -<p>Modify the shell to allow users to edit the command line +There are endless ways in which the shell could be extended. Here are +some suggestions: + +<ul> +   +<li>Modify the shell to support wait. +<li>Modify the shell to support lists of commands, separated by ";" + +<li>Modify the shell to support sub-shells by implementing "(" and ")" + +<li>Modify the shell to allow users to edit the command line + +</ul> +  </body>  </html> | 
