1 / 12

CSC 4630

CSC 4630. Meeting 4 January 29, 2007. Mysteries. What do we need to resolve? What issues did the Moby Dick homework raise?. What About Shells. What do you know about the UNIX shell?. The Shell. A program, specifically a command interpreter Special properties

jadzia
Download Presentation

CSC 4630

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. CSC 4630 Meeting 4 January 29, 2007

  2. Mysteries • What do we need to resolve? • What issues did the Moby Dick homework raise?

  3. What About Shells • What do you know about the UNIX shell?

  4. The Shell • A program, specifically a command interpreter • Special properties • Limited understand of regular expressions to denote sets of files • I/O redirection • User defined commands

  5. Shell: Regular Expressions • * matches any string, including the empty string. Equivalent to .* for grep • [s] matches any single element of the set s. The set can include ASCII ranges, for example m-t designates the set {m n o p q r s t}

  6. Shell: I/O Redirection • Four symbols < Take input from > Send output to, overwriting what was previously there >> Send output to, appending new information to the end of the file | Use output from first command as input to second command

  7. Shell: Command Interpreter • Single word commands • Names a file for execution, e.g. who means run the command file /bin/who • Command termination • newline • semi-colon ; • ampersand &

  8. Shell: Command Interpreter (2) • Command grouping: compare • date; who (a sequence of commands on one line with • date; who | wc (Which of ; and | has higher precedence?) with • (date; who) | wc with • date; (who | wc)

  9. Shell: Command Interpreter (3) • The ampersand means run the command in the background. • Example: (sleep 5 ; date) & date

  10. Shell: Exercises • Compare ls junk and echo junk, where junk is the name of a file in the current directory. • Compare ls / and echo / • Compare ls and echo (given as commands with no arguments) • Compare ls * and echo * • Compare ls ‘*’ and echo ‘*’

  11. Shell: Exercises (2) • Explain the results of ls > ls.out • Explain the results of wc temp > temp • Explain the results of whom (given as a command without an argument) • Compare who | sort and who > sort • Compare • cat file | pr with • pr < file with • pr file

  12. Shell: Exercises (3) • Explain the results of ls .*

More Related