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.

Slides:



Advertisements
Similar presentations
CIS 240 Introduction to UNIX Instructor: Sue Sampson.
Advertisements

Introduction to Unix – CS 21 Lecture 11. Lecture Overview Shell Programming Variable Discussion Command line parameters Arithmetic Discussion Control.
Find Command Characteristics –Locate files descending from multiple starting points –Employs regular expressions Examples On entire system: >find / -name.
More about Shells1-1 More about Shell  Shells (sh, csh, ksh) are m Command interpreters Process the commands you enter m High-level programming languages.
CS 497C – Introduction to UNIX Lecture 22: - The Shell Chin-Chih Chang
CS Lecture 03 Outline Sed and awk from previous lecture Writing simple bash script Assignment 1 discussion 1CS 311 Operating SystemsLecture 03.
CIS 240 Introduction to UNIX Instructor: Sue Sampson.
Shell Programming Learning Objectives: 1. To understand the some basic utilities of UNIX File 2. To compare UNIX shell and popular shell 3. To learn the.
Guide To UNIX Using Linux Third Edition
Guide To UNIX Using Linux Third Edition
Guide to Linux Installation and Administration, 2e1 Chapter 6 Using the Shell and Text Files.
Introduction to Unix (CA263) Introduction to Shell Script Programming By Tariq Ibn Aziz.
Shell Programming 1. Understanding Unix shell programming language: A. It has features of high-level languages. B. Convenient to do the programming. C.
Bash Shell Scripting 10 Second Guide Common environment variables PATH - Sets the search path for any executable command. Similar to the PATH variable.
Introduction to Linux and Shell Scripting Jacob Chan.
Shell Programming. Shell Scripts (1) u Basically, a shell script is a text file with Unix commands in it. u Shell scripts usually begin with a #! and.
7/17/2009 rwjBROOKDALE COMMUNITY COLLEGE1 Unix Comp-145 C HAPTER 2.
Shell Control Structures CSE 2031 Fall August 2015.
CTEC 1863 – Operating Systems Shell Scripting. CTEC F2 Overview How shell works Command line parameters –Shift command Variables –Including.
Shell Programming, or Scripting Shirley Moore CPS 5401 Fall August 29,
Agenda Control Flow Statements Purpose test statement if / elif / else Statements for loops while vs. until statements case statement break vs. continue.
Introduction to Shell Script Programming
Chapter Nine Advanced Shell Scripting1 System Programming Advanced Shell Scripting.
8 Shell Programming Mauro Jaskelioff. Introduction Environment variables –How to use and assign them –Your PATH variable Introduction to shell programming.
Chapter 6: Shell Programming
Unix Shells Based on Glass & Abels’ Book CS240 Computer Science II.
The UNIX Shell. The Shell Program that constantly runs at terminal after a user has logged in. Prompts the user and waits for user input. Interprets command.
July 17, 2003Serguei A. Mokhov, 1 Shells and Shell Scripts COMP 444/5201 Revision 1.3 January 25, 2005.
Shell Script Programming. 2 Using UNIX Shell Scripts Unlike high-level language programs, shell scripts do not have to be converted into machine language.
Additional UNIX Commands. 222 Lecture Overview  Multiple commands and job control  More useful UNIX utilities.
Introduction to Linux OS (IV) AUBG ICoSCIS Team Prof. Volin Karagiozov March, 09 – 10, 2013 SWU, Blagoevgrad.
Introduction to Bash Programming Ellen Zhang. Previous three classes What have we learnt so far ?
Linux+ Guide to Linux Certification, Third Edition
Writing Shell Scripts ─ part 3 CSE 2031 Fall October 2015.
Linux Operations and Administration
Scripting Languages Course 2 Diana Trandab ă ț Master in Computational Linguistics - 1 st year
Shell Programming Any command or a sequence of UNIX commands stored in a text file is called a shell program. It is common to call this file a command.
CS465 - UNIX The Bourne Shell.
Chapter 10: BASH Shell Scripting Fun with fi. In this chapter … Control structures File descriptors Variables.
(A Very Short) Introduction to Shell Scripts CSCI N321 – System and Network Administration Copyright © 2000, 2003 by Scott Orr and the Trustees of Indiana.
Writing Scripts Hadi Otrok COEN 346.
CIT 140: Introduction to ITSlide #1 CIT 140: Introduction to IT Shell Programming.
Chapter Six Introduction to Shell Script Programming.
1 Unix/Linux commands and shell programming-Part 2 (Dr. Mohamed El Bachir Menai)
CSCI 330 UNIX and Network Programming Unit III Shell, Part 1.
Introduction to Bash Shell. What is Shell? The shell is a command interpreter. It is the layer between the operating system kernel and the user.
CSCI 330 UNIX and Network Programming Unit X: Shell Scripts II.
Lesson 6-Using Utilities to Accomplish Complex Tasks.
CS 403: Programming Languages Lecture 20 Fall 2003 Department of Computer Science University of Alabama Joel Jones.
By Dr P.Padmanabham Professor (CSE)&Director Bharat Institute of Engineering &Technology Hyderabad Mobile
Chapter 15 Introductory Bourne Shell Programming.
Linux Administration Working with the BASH Shell.
Shell Control Structures CSE 2031 Fall June 2016.
Shell Control Structures
Prepared by: Eng. Maryam Adel Abdel-Hady
INTRODUCTION TO UNIX: The Shell Command Interface
Writing Shell Scripts ─ part 3
Writing Shell Scripts ─ part 3
Agenda Control Flow Statements Purpose test statement
CSCI The UNIX System Shell Startup and Variables
UNIX Reference Sheets CSE 2031 Fall 2010.
Linux Shell Script Programming
Shell Control Structures
Shell Control Structures
CSC 4630 Meeting 4 January 29, 2007.
Introduction to Bash Programming, part 3
Basic shell scripting CS 2204 Class meeting 7
Review.
SPL – PS1 Introduction to C++.
Review The Unix Shells Graham Glass and King Ables,
Presentation transcript:

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 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

The Future

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

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?

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

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

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

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

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 &

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

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

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

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)

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

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

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