Class Notes (837,186)
Canada (510,155)
CSC209H1 (41)
Karen Reid (20)
Lecture

jan07c.docx

3 Pages
105 Views
Unlock Document

Department
Computer Science
Course
CSC209H1
Professor
Karen Reid
Semester
Winter

Description
SHELL PROGRAMMING Desktop Downloads Movies Pictures testdir  Why Unix Documents Library Music Public o Available on number of platforms $ cd testdir $ ls o Multi-user, multi-programmed asdf o Shares computer resources sensibly $ cd .. # exit test dir directory o Permits manipulation of files, processes and programs o Allows inter-process and inter-machine communication $ rmdir testdir rmdir: testdir: Directory not empty o Permits access to its operating features $ cd testdir o The unix philopshy: rm asdf  Write programs that do one thing and do it well $ cd .. # exit test dir directory  Write programs to work together $ rmdir testdir  Write programs that handle text streams, because it’s a Desktop Downloads Movies Pictures universal interface Documents Library Music Public  Software Tools  cat – concatenate and print given files o A good tool does one or two basic things well  does not change the files o A good tool can be combined w/ other good tools $ cat faculty Craig, Michelle o Principles: Craig, Mike  Do one basic thing well  With some basic variations O'Neil, Craig  Simple input formats Reid, Karen Gries, Paul  Plain text Craigleith, Jim  Don’t require interactive input Horton, Diane  Simple output format Campbell, Jennifer  Expected to be input to another tool Heap, Danny  Shell, a program that can execute another program  for concatenation see example under st input/st output o The % is the shell prompt for csh, the $ is the shell prompt for  sort – sort the lines of text files o Shells  can give a file name to sort the file or sort standard input  Accept commands (programs) as input from user entered strings  Finds the executable $ sort faculty # sorting file  Interprets the arguments Campbell, Jennifer  Starts executing the command Craig, Michelle o Shells also have some “built-in” commands Craig, Mike o Comments indicated by strings after # Craigleith, Jim $ ls #this is a comment Gries, Paul Heap, Danny Week1-2-Shell.key Week1-Intro.key faculty sorted_faculty topics.pages Horton, Diane o Common commands (tools) in shell O'Neil, Craig  Echo – write arguments to standard output Reid, Karen echo this is standard output $ sort # sort standard input this is standard output This is # the input fun  ls – list directory contents isn't  if no path following, lists working directory it? # stop input by ctrl-D $ ls Week1-2-Shell.key Week1-Intro.key Fun # the sorted order faculty sorted_faculty topics.pages isn't it? $ ls /Users/Yan This is Desktop Downloads Movies Pictures $ sort –k 2 # sort second character Documents Library Music Public aaaa z # the input  pwd – return working directory name bbbb y $ pwd /Users/Yan bbbb x # the sorted cccc y  cd – built in command, change directory  Standard input/standard output  cd or cd ~ changes working directory to home  Most commands has a standard output, which can be directory, ~ is sort for home directory piped into other commands or be saved as a file  cd . doesn’t change working directory since . is short  Pipes (explained later) for current working directory  Used > to save to a file, must be new  cd .. moves up one directory $ sort faculty > new_sorted_faculty  cd – switch ot previously opened directory $ cat new_sorted_faculty  mkdir – make directories Campbell, Jennifer Craig, Michelle $ ls Desktop Downloads Movies Pictures Craig, Mike Documents Library Music Public Craigleith, Jim $ mkdir testdir Gries, Paul $ ls Heap, Danny Desktop Downloads Movies Pictures testdir Horton, Diane Documents Library Music Public O'Neil, Craig Reid, Karen  rmdir – removes directory, must be empty $ echo this is file1 > file1 $ ls $ cat file1 this is file1 tg pts/11 Jan 8 15:40 (206- $ echo what does this do? > file2 248-190-13.dsl.teksavvy.com) $ cat file2 mcraig pts/6 Jan 9 17:13 (red- what does this do? gw71.cs.toronto.
More Less

Related notes for CSC209H1

Log In


OR

Join OneClass

Access over 10 million pages of study
documents for 1.3 million courses.

Sign up

Join to view


OR

By registering, I agree to the Terms and Privacy Policies
Already have an account?
Just a few more details

So we can recommend you notes for your school.

Reset Password

Please enter below the email address you registered with and we will send you a link to reset your password.

Add your courses

Get notes from the top students in your class.


Submit