Week Five Agenda Link of the week Review week four lab assignment This week’s expected outcomes Next lab assignment Break-out problems Upcoming deadlines.

Slides:



Advertisements
Similar presentations
Shell Scripting Printing; Loops and Logic printf: formatted print printf is a more standardized method to print text to the screen. It can be used instead.
Advertisements

CIS 240 Introduction to UNIX Instructor: Sue Sampson.
Week Five Agenda Announcements Link of the week Review week four lab assignment This week’s expected outcomes Next lab assignment Break-out problems Read.
Week Four Agenda Announcements Link of the week Review week three lab assignment This week’s expected outcomes Next lab assignment Break-out problems.
Introduction to Unix – CS 21 Lecture 11. Lecture Overview Shell Programming Variable Discussion Command line parameters Arithmetic Discussion Control.
CS Lecture 03 Outline Sed and awk from previous lecture Writing simple bash script Assignment 1 discussion 1CS 311 Operating SystemsLecture 03.
CS 497C – Introduction to UNIX Lecture 33: - Shell Programming Chin-Chih Chang
Bash, part 2 Prof. Chris GauthierDickey COMP Unix Tools.
Shell Programming 1. Understanding Unix shell programming language: A. It has features of high-level languages. B. Convenient to do the programming. C.
Week Four Agenda Announcements Link of the week Review week three lab assignment This week’s expected outcomes Next lab assignment Break-out problems.
Lab 8 Shell Script Reference:
Sydney Opera House. Week Three Agenda Administrative Issues Link of the week Review week two lab assignment This week’s expected outcomes Next lab assignment.
Week Four Agenda Announcements Link of the week Review week three lab assignment This week’s expected outcomes Next lab assignment Upcoming deadlines Lab.
Week Five Agenda Announcements Link of the week Review week four lab assignment This week’s expected outcomes Next lab assignment Break-out problems Read.
Week Three Agenda Administrative Issues Link of the Week Review Week Two Information This Week’s Expected Outcomes Next Lab Assignment Break-Out Problems.
Week Five Agenda Announcements Link of the week Review week four lab assignment This week’s expected outcomes Next lab assignment Break-out problems Read.
CMPSC 60: Week 6 Discussion Originally Created By: Jason Wither Updated and Modified By: Ryan Dixon University of California Santa Barbara.
Course materials may not be reproduced in whole or in part without the prior written permission of IBM. 5.1 © Copyright IBM Corporation 2008 Unit 11: Shell.
1 System Administration Introduction to Scripting, Perl Session 3 – Sat 10 Nov 2007 References:  chapter 1, The Unix Programming Environment, Kernighan.
CSC 352– Unix Programming, Spring 2015 March 2015 Shell Programming (Highlights only)
Week Five Agenda Announcements Link of the week Review week four lab assignment This week’s expected outcomes Next lab assignment Reading assignments Upcoming.
Week Five Agenda Announcements Link of the week Review week four lab assignment This week’s expected outcomes Next lab assignment Break-out problems Read.
1 © 2001 John Urrutia. All rights reserved. Chapter 10 using the Bourne Again Shell.
Shell Programming. Creating Shell Scripts: Some Basic Principles A script name is arbitrary. Choose names that make it easy to quickly identify file function.
Agenda Link of the week Use of Virtual Machine Review week one lab assignment This week’s expected outcomes Review next lab assignments Break Out Problems.
Perl Practical(?)‏ Extraction and Report Language.
Week Four Agenda Announcements Link of the week Review week three lab assignment This week’s expected outcomes Next lab assignment Break-out problems.
Week Four Agenda Announcements Link of the week Review week three lab assignment This week’s expected outcomes Next lab assignment Break-out problems.
Week Six Agenda Announcements (in-class question) Link of the week Review week four lab assignment This week’s expected outcomes Next lab assignment Review.
Week Two Agenda Announcements Link of the week Use of Virtual Machine Review week one lab assignment This week’s expected outcomes Next lab assignments.
Week Two Agenda Announcements Link of the week Use of Virtual Machine Review week one lab assignment This week’s expected outcomes Next lab assignments.
Perl Language Yize Chen CS354. History Perl was designed by Larry Wall in 1987 as a text processing language Perl has revised several times and becomes.
Chapter 10: BASH Shell Scripting Fun with fi. In this chapter … Control structures File descriptors Variables.
Week Two Agenda Announcements Link of the week Use of Virtual Machine Review week one lab assignment This week’s expected outcomes Next lab assignments.
Shells. Variables MESSAGE="HELLO WORLD" echo $MESSAGE MESSAGE="HELLO WORLD $LOGNAME" echo $MESSAGE MESSAGE="HELLO WORLD $USER" echo $MESSAGE.
Week Six Agenda Announcements Link of the week Review week four lab assignment This week’s expected outcomes Next lab assignment Break-out problems Upcoming.
©Colin Jamison 2004 Shell scripting in Linux Colin Jamison.
Sydney Opera House. Week Three Agenda Administrative Issues Link of the week Use of the Virtual Machine Review week two lab assignment This week’s expected.
1 © 2000 John Urrutia. All rights reserved. Session 5 The Bourne Shell.
CSCI 330 UNIX and Network Programming Unit IX: Shell Scripts.
CS252: Systems Programming Ninghui Li Slides by Prof. Gustavo Rodriguez-Rivera Topic 7: Unix Tools and Shell Scripts.
Shell Script2 Reference: Linux Shell Scripting Tutorial v1.05r3 A Beginner's handbook
Week Two Agenda Announcements Link of the week Use of Virtual Machine Review week one lab assignment This week’s expected outcomes Next lab assignments.
Shell Programming Features “Full” programming language “Full” programming language Conditional statements Conditional statements Arithmetic, String, File,
Department of Electrical and Computer Engineering Introduction to Perl By Hector M Lugo-Cordero August 26, 2008.
Sydney Opera House. Week Three Agenda Administrative Issues Link of the week Use of the Virtual Machine Review week two lab assignment This week’s expected.
Week Five Agenda Announcements Link of the week Review week four lab assignment This week’s expected outcomes Next lab assignment Break-out problems Read.
Week Four Agenda Link of the week Review week three lab assignment This week’s expected outcomes Next lab assignment Break-out problems Upcoming deadlines.
Flow Control. The order in which commands execute in a shell script is called the flow of the script. When you change the commands that execute based.
Sed. Class Issues vSphere Issues – root only until lab 3.
Lab 8 Shell Script Reference: Linux Shell Scripting Tutorial v1.05r3 A Beginner's handbook
Shell script – part 2 CS 302. Special shell variable $0.. $9  Positional parameters or command line arguments  For example, a script myscript take 2.
Week Four Agenda Announcements Link of the week Review week three lab assignment This week’s expected outcomes Next lab assignment Break-out problems.
#!/bin/sh 2002/07/26 Jaeho Shin. Interface between user and the operating system sh, bash, csh, tcsh, ksh, … What is a “Shell”? OSuser Shell.
2 nd Intro to Shell Scripting. Dates for Last Week of Class Homework 7 – Due Tuesday 5/1 by midnight Labs 7 & 8 or late ones – 8 is extra credit – Due.
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
Week Two Agenda Announcements Link of the week Use of Virtual Machine Review week one lab assignment This week’s expected outcomes Next lab assignments.
Shell Scripting September 27, 2004 Class Meeting 6, Part II * Notes adapted by Lenwood Heath from previous work by other members of the CS faculty at Virginia.
Week Four Agenda Announcements Link of the week Review week three lab assignment This week’s expected outcomes Next lab assignment Break-out problems.
1 Lecture 8 Shell Programming – Control Constructs COP 3353 Introduction to UNIX.
Week Four Agenda Announcements Link of the week Review week three lab assignment This week’s expected outcomes Next lab assignment Break-out problems.
CSC 352– Unix Programming, Spring 2016, Final Exam Guide
CSC 352– Unix Programming, Fall 2012
Part 1: Basic Commands/Utilities
Week Five Agenda Announcements Link of the week
UNIX Reference Sheets CSE 2031 Fall 2010.
Presented by, Mr. Satish Pise
CSC 352– Unix Programming, Fall, 2011
Introduction to Bash Programming, part 3
Presentation transcript:

Week Five Agenda Link of the week Review week four lab assignment This week’s expected outcomes Next lab assignment Break-out problems Upcoming deadlines Questions and answers

Link of the week Data Disaster Data Disaster - Use dedicated circuits for your connection - Keep your computer cool and in a dry place - Use a UPS (Uninterrupted Power Supply) - Don’t assume that your data is permanently destroyed

Link of the week Data Disaster - Big and small company operations - Backup services - Trouble shooting - Data recovery Define: Power Monkey Define: Thermal Logic Technology

Review week four lab assignment Shell Commands cat chmod cp date find grep mkdir more less rmdir rm sort sleep wc kill diff cd whence umask

Review week four lab assignment Shell Arithmetic expressions <=- less than or equal tp >=- greater than or equal to <- less than >- greater than ==- equal to !=- not equal to *- multiplication /- division +- addition -- subtraction Shell statements printf “string”- output a string of information echo $COUNTER- output content of the variable COUNTER printf $NUMBER- output content of the variable NUMBER NUMBER=$(($NUMBER-1)) - decrease NUMBER value by one $# - number of positional parameters $? - return value $$ - prosess id of this shell $! - bachground process id

Review week four lab assignment Shell Conditional Expression Primitives -r - true if file exists and is readable -w - true if file exists and is writable -x- true if file exists and is executable -f- true if file exists and is a file -d- true if file exists and is a directory -eq- true if value of exp1 and exp2 are equal -ne- true if value of exp1 and exp2 are not equal -gt- true if value of exp1 is greater than value of exp2 -ge- true if value of exp1 is greater than or equal to value of exp2 -lt- true if value of exp1 is less than value of exp2 -le- true if value of exp1 less than or equal to value of exp2 Shell Quoting ‘ …’- single literal quotes “…”- double quotes (interpolation allowed) `…`- single back ticks (command execution)

Review week four lab assignment Shell I/O Redirection < variable- read from file (cat < test_file) > variable- write to a file (cat > test_file) variable >> variable- append content of file_1 to the end of file_2 (cat file_1 >> file_2) Shell Syntax while [ … ] do … done if [ … ] then … fi if [ … ] then … elif … fi test –r “$test_file” test x+1 –gt y

Review week four lab assignment Perl Binary Arithmetic Operators +- addition ($a + $b) *- multiplication ($a * $b) %- modulus (remainder of $a divided by $b) **- exponentiation ($a raised to the power of $b) Perl Comparison Operators ==- equal !=- not equal <- less than >- greater than <=- less than or equal >=- greater than or equal  - comparison (0 if equal, 1 if $variable_1 greater, -1 if $variable_2 greater

Review week four lab assignment Perl Comparison Operators eq- equal ne- not equal lt- less than gt- greater than le- less than or equal ge- greater than or equal cmp- comparison (0 if equal, 1 if $variable_1 greater, -1 if $variable_2 greater Perl Conditional Expression Primitives -e $var- true if file $var exists -r $var- true if file $var is readable -w $var- true if file $var is writable -d $var- true if $var is a directory -f $var- true if file $var is a file -T $var- true if file $var is a text file

Review week four lab assignment Perl Quotes “ “ double-quotes ‘ ‘ single-quotes ` ` backtick-quotes Perl String Operators $arrayexp[0]=“string assignment”; (string assignment to zero element of array) $cmdexp=`ls –l`; (string output from a command) $charexp=‘b’; (string character assignment) $strexp=“string assignment”; (string assignment) $intexp=150; (an integer) $str_int=“I have two $pets”; (string with interpolation) Perl Commands chop unless print $var pop

Review week four lab assignment Perl Variable Syntax $ singular variables prefix (single value, number or prefix for plural variable (array) %prefix for plural variable (hash) $_ default variable Relational Operators Equality Operators

Review week four lab assignment Perl Syntax while ( … ) { … } If ( …) { … } If ( … ) { … } else { … }

Review week four lab assignment Perl Syntax ;end of statement delimiter,comma for line continuation \nnew line

Weeks four and five expected outcomes Write Perl scripts, including variables, control flow, and regular expression syntax

Next lab assignment Programming Perl, Chapter 32 Standard Modules Define: Module Parsing the command line with Getopt::Std Example: listdir –l –n –a 10:00 bottom top Perl to capture the command line arguments Example: $ARGV[0] ‘-l’ $ARGV[1]‘-n’ $ARGV[2]‘-a’ $ARGV[3]’10:00’ $ARGV[4]‘bottom’ $ARGV[5]‘top’

Next lab assignment Perl = (“rake”, “mower”, “shovel”); ($rake, $mower, $shovel) Perl Hash %colormap=( “12” => “gray”, “19” => “black”, “30” => “red”,); %colormap = (“12”, “gray”, “19”, “black”, “30”, “red”);

Break-out problems Global variable Boolean Binary Executable file Execute bit fork command Portable Object file System call Data structure

Upcoming deadlines Simple Perl Script, 5-1 is due 6/1/08. Makefile Exercise, 7-2 is due 6/15/08. Mid-term exam dates 6/9/08 through 6/14/08. Programming Assignment 1, 6-1 is due 6/22/08. -Script logic for the above assignment will be ed at the end of the week. Reading Assignment Essential System Administration Chapter One, pages 1 -8, 12 – 28 Chapter Two, pages 32 – 61 Chapter Three Programming Perl Chapter One Chapter Two, pages 47 – 65, 69 – 73, Chapter Three, pages 86 – 90, Chapter Thirty Two, pages 865 – 867, 899

Questions and answers Questions Comments Concerns After class I will help students with their scripts.