Presentation is loading. Please wait.

Presentation is loading. Please wait.

CSC 4630 Meeting 5 January 31, 2007. Next Time Enhance the steps that you used to clean the Moby Dick chapter to create a shell script that takes any.

Similar presentations


Presentation on theme: "CSC 4630 Meeting 5 January 31, 2007. Next Time Enhance the steps that you used to clean the Moby Dick chapter to create a shell script that takes any."— Presentation transcript:

1 CSC 4630 Meeting 5 January 31, 2007

2 Next Time Enhance the steps that you used to clean the Moby Dick chapter to create a shell script that takes any chapter as input and produces the ordered lexicon of the chapter with frequency counts of word use. Call the script mobile and save it in your directory CSC4630/scripts

3 The Future

4 Setting the Stage What’s the difference between –A programming language and a scripting language –An interpreted language and a compiled language

5 Setting the Stage (2) What features do you expect a programming language to have? Do these differ if the language is compiled rather than interpreted?

6 Scripting Languages Variables –Global –Local Control structures –Decision –Looping –Sequence

7 UNIX Shells Variables –By convention, variables with special meaning are designated in upper case. –User created variables are designated in lower case. –Positional parameters are numbered 1 through 9. Setting and displaying values of variables

8 Shell Variables Distinguish between the name of the variable and the value of a variable with a particular name. – foo vs. $foo

9 Shell Variables (2) Special shell variables (global variables) – PATH, the search path – HOME, your login directory – PS1 – PS2 – IFS – MAIL

10 Shell Variables (3) Some shell variables are denoted by symbols. Traditionally we use the notation for the values of those variables when talking about them. $# -- number of arguments $* -- values of all the arguments $- -- options supplied to shell $? -- return value of previous command $$ -- process-id of shell $! -- process-id of most recent command started with &

11 Managing Shell Variables Creating dir=`pwd` (Note: the output of any command can be placed in a command line by enclosing the invocation of the command in backquotes.) Showing the value echo $dir

12 Managing Shell Variables Showing the value of all shell variables set Example today=`date` echo $today echo date echo `date` `date`

13 Control Structures Looping for i in list do command done while command do command done repeat command until command done Decision if command then command else command fi case value in cases esac

14 Project 1 Logic –Clear header –Clear trailer –Remove html tags –Remove page designations –Put one word per line –Remove trailing punctuation –Remove leading upper case letters (assuming beginning of sentence words)

15 Project 1 (2) –Sort words –Create unique list with counts –Sort by frequency

16 Project 1 (3) Bugs –Numbers –Names –Lost chapter number

17 Project 1 (4) Bug fixes –Chapter number Roman numeral conversion


Download ppt "CSC 4630 Meeting 5 January 31, 2007. Next Time Enhance the steps that you used to clean the Moby Dick chapter to create a shell script that takes any."

Similar presentations


Ads by Google