Week Four Agenda Announcements Link of the week Review week three lab assignment This week’s expected outcomes Next lab assignment Upcoming deadlines Lab.

Slides:



Advertisements
Similar presentations
1/12 Steven Leung Very Basic Perl Tricks A Few Ground Rules File I/O and Formatting Operators, Flow Control Statements Regular Expression Subroutines Hash.
Advertisements

A Guide to Unix Using Linux Fourth Edition
● Perl reference
Week Four Agenda Announcements Link of the week Review week three lab assignment This week’s expected outcomes Next lab assignment Break-out problems.
Linux Basic TA for ITIS3100: Xu Fei
CS Lecture 03 Outline Sed and awk from previous lecture Writing simple bash script Assignment 1 discussion 1CS 311 Operating SystemsLecture 03.
Linux+ Guide to Linux Certification, Second Edition
The Unix Shell. Operating System shell The shell is a command interpreter It forms the interface between a user and the operating system When you log.
Guide To UNIX Using Linux Third Edition
Guide To UNIX Using Linux Third Edition
Shell Programming 1. Understanding Unix shell programming language: A. It has features of high-level languages. B. Convenient to do the programming. C.
Unix Shell Scripts. What are scripts ? Text files in certain format that are run by another program Examples: –Perl –Javascript –Shell scripts (we learn.
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 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.
Shell Script Examples.
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.
Practical Extraction & Report Language PERL Joseph Beltran.
Week 7 Working with the BASH Shell. Objectives  Redirect the input and output of a command  Identify and manipulate common shell environment variables.
Guide To UNIX Using Linux Fourth Edition
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 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.
INTRODUCTION TO LINUX Jacob Chan. GNU/Linux Consists of Linux kernel, GNU utilities, and open source and commercial applications Works like Unix –Multi-user.
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.
Linux+ Guide to Linux Certification, Third Edition
1 System Administration Introduction to Scripting, Perl Session 3 – Sat 10 Nov 2007 References:  chapter 1, The Unix Programming Environment, Kernighan.
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.
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.
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.
Introduction to Perl Yupu Liang cbio at MSKCC
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.
Lecture 24CS311 – Operating Systems 1 1 CS311 – Lecture 24 Outline Final Exam Study Guide Note: These lecture notes are not intended replace your notes.
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.
Agenda Administrative Issues Link of the Week Review Week Two Information This Week’s Expected Outcomes Moving around in UNIX Break-Out Problems Upcoming.
(A Very Short) Introduction to Shell Scripts CSCI N321 – System and Network Administration Copyright © 2000, 2003 by Scott Orr and the Trustees of Indiana.
Chapter Four I/O Redirection1 System Programming Shell Operators.
Week Three Agenda Administrative Issues Link of the Week Review Week Two Information This Week’s Expected Outcomes Next Lab Assignment Break-Out Problems.
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.
CSCI 330 UNIX and Network Programming Unit IX: Shell Scripts.
Week Three Agenda Administrative Issues Link of the week Review week two lab assignment This week’s expected outcomes Next lab assignment Upcoming deadlines.
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 Three Agenda Administrative Issues Link of the Week Review Week Two Information This Week’s Expected Outcomes Next Lab Assignment Break-Out Problems.
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.
Agenda Administrative Issues Link of the Week Review Week Two Information This Week’s Expected Outcomes Moving around in UNIX Break-Out Problems Upcoming.
Agenda Administrative Issues Link of the Week Review Week Two Information This Week’s Expected Outcomes Next Lab Assignment Break-Out Problems Upcoming.
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.
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.
Sed. Class Issues vSphere Issues – root only until lab 3.
Linux+ Guide to Linux Certification, Second Edition
Week Four Agenda Announcements Link of the week Review week three lab assignment This week’s expected outcomes Next lab assignment Break-out problems.
A Brief Overview of Unix Brandon Bohrer. Topics What is Unix? – Quick introduction Documentation – Where to get it, how to use it Text Editors – Know.
Agenda Administrative Issues Link of the Week Review Week Two Information This Week’s Expected Outcomes Moving around in UNIX Break-Out Problems Upcoming.
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.
Linux Administration Working with the BASH Shell.
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 Two Agenda Announcements Link of the week Use of Virtual Machine
Week Three Agenda Link of the Week Review Week Two Information
Part 1: Basic Commands/Utilities
Sydney Opera House.
Week Five Agenda Announcements Link of the week
Week Three Agenda Link of the Week Review Week Two Information
UNIX Reference Sheets CSE 2031 Fall 2010.
Linux Shell Script Programming
Presentation transcript:

Week Four Agenda Announcements Link of the week Review week three lab assignment This week’s expected outcomes Next lab assignment Upcoming deadlines Lab assistance, questions and answers

Link of the week Object Code What is object code? What format is object code in? How are object files applied where large systems are packaged?

Proctor & Attendance I still need a proctor from some of you.. You won’t be able to take the midterm until a proctor is approved A reminder that attendance is kept for this course, and you receive 10 points for each session you attend (~130 points total) – you can turn in summaries up to the time the Saturday after the session missed.

Logic scripts “..” needs your input – typically expressions for if statements, but may need other commands, like echo, print, etc.. “variable” or $variable – needs you to change it to a variable name of your choice – just be consistent Future logic scripts may include “syntax” errors, or typos that you need to correct to make the script run properly. You may see $? – or index number in scripts which also means for you to supply a variable name Don’t forget the comments at the top (Author, Function, Lab Assignment, Date, etc.)

Link of the week

Review Week Three Lab Assignment What is a filter? A UNIX filter command performs an operation or manipulation of text in a file. Standard in and out are typically used during this operation. Shell Command Line Filters awk, cat, cut, expand, compress, fold, grep, head, nl, perl, pr, sed, sh, sort, split, strings, tail, tac, tee, tr, uniq, and wc

Review Week Three Lab Assignment Shell File System Filters cat, cd, chmod, chown, chgrp, cksum, cmp, cp, dd, du, df, fsck, fuser, ln, ls, lsattr, lsof, mkdir, mount, mv, pwd, rm, rmdir, split, touch, umask Shell Process Filters at, chroot, cron, exit, kill, killall, nice, pgrep, pidof, pkill, ps, pstree, sleep, time, top, and wait

Review Week Three Lab Assignment Test Command A common way to set up a condition for the if command is with the test command. test condition or [ condition ] The test command evaluates the condition and returns 0 or 1, depending on the results of the test. The brackets work exactly like the test condition. The open bracket is a link to test.

Review Week Three Lab Assignment Constructing Conditions -s file-r file-w file -x file-f file-d file Examples: if [ ! –f /etc/.fsckask ] If the plain file /etc/.fsckask does not exist If [ -d /etc/rc0.d ] If there is a directory named /etc/rc0.d

Review Week Three Lab Assignment Commands cal –y (display a calendar for the year) cal –j 2010 (display Julian dates) cal –m 2010 (display Monday first day) cal –s 2010 (display Sunday first day) cal (display September 2010 month)

Review week three lab assignment Perl is a simple language that compiles and executes like a shell or batch type file. Perl doesn’t impose special growth limitations on an array or data strings Perl is a composite of C, AWK, and Basic. Perl was originally developed to manipulate text information.

Review week three lab assignment Perl’s capabilities range from - System administration - Web development - Network programming - GUI development Perl’s major features are -Procedural Programming makes use of simple sequential steps, routines, subroutines, and methods. -Object Oriented Programming (OOP) makes use of “objects”. The key elements of are inheritance, modularity, polymorphism, and encapsulation.

Review week three lab assignment Perl ~ Shell $# Perl $ARGV[0] ~ Shell $1 Perl $ARGV[1] ~ Shell $2 Perl ~ Shell if [ $# != 2] All Perl statements are terminated with a “;” Perl exit 0 is returned if execution was successful Perl exit 1 is returned if execution fails The return value for a child process is returned to the parent process when the child process terminates.

Review week three lab assignment $? – this variable contains the return value # - precedes a comment statement in Perl \n - new line syntax “ …” $strexp = “This text is considered as a string”; ‘ …’ $charexp = ‘a’; ` …` $cmdexp = `ls – array containing command line arguments $_ - default implied scalar

Review week three lab assignment A process associates a number with each file that it has opened. This number is called a file descriptor. When you log in, your first process has the following three open files connected to your terminal. Standard Input (stdin) : File descriptor 0 is open for reading. < really means <0 Standard Output (stdout): File descriptor 1 is open for writing. > really means 1> Standard Error (stderr): File descriptor 2 is open reading. >> really means 1>>

Review week three lab assignment The open function can be used to create file handles for different purposes (input, output, piping), you need to be able to specify which behavior you want. open functions open(file_handler, “file_name”) open(file_handler, “<file_name”) open (file_handler, “>file_name”) open (file_handler, “>>file_name”)

Review week three lab assignment There are two types of relational operators. One class operates on numeric values, the other on string values. Relational operators Numeric String Meaning > gt Greater than >= ge Greater than or equal < lt Less than <=le Less than or equal

Review week three lab assignment Equality Operators Numeric String Meaning == eq Equal to != ne Not equal to  cmp Comparison, sign results -1 if the left operand is less 0 If both operands equal 1 If the left operand is greater

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

Next lab assignment Perl is designed to - Process text data - Perform pattern matching - Utilize string handling tasks Perl is available on many platforms - UNIX - Linux - HP-UX

Next Lab Assignment Perl utilizes two types of categories - Singular variables that represent a single-value. The variable prefix symbol for a scalar is the $. - Plural variables are ones that contain multiple-values. Arrays and hashes are two multi-valued variables. Perl data types $answer = 42; (an integer) $pi = ;(a “real” number) $animal = “horse”; (string) $statement = “I exercise my $animal”; (string with interpolation) $amount = ‘It cost me $5.00’; (string without interpolation) $cwd = `pwd`; (string output from a command)

Next Lab = (“car”, “mower”, “broom”); Definition: An array is an ordered list of scalars, accessed by the scalar’s position in the = (“Will”, “Karim”, “Asma”, “Jay”); $count Demonstrate: Execute week_four.pl script

Next Lab Assignment Open Statement The open function can be used to create file handles for different purposes (input, output, piping), you need to be able to specify which behavior you want.

Next Lab Assignment open functions open(file_handler, “file_name”) open(file_handler, “<file_name”) open (file_handler, “>file_name”) open (file_handler, “>>file_name”)

Next Lab Assignment Filehandle is utilized for both input and output files. Most file names are cryptic and are meaningless to programmers. The purpose of a filehandle is to help the programmer remember a simple file name throughout a program. A filehandle is a name given for a file, device, socket, or pipe. Filehandle command line format: open(filehandle, file name, permissions, chmod); Example: open($FH,$file_name);

Next Lab Assignment What is List = (6 - 4, 4 * 4, 8 / 2, 9 - 8); while ( … ) { … } for (counter = 0; counter < 10; counter++) { … } Three expressions are contained in a for loop: 1.Set initial state of the loop variable 2.Condition test the loop variable 3.Modify the state of the loop variable

Next Lab Assignment foreach VAR (List) { … } Demonstrate: Execute read_list.pl = ('Larry', 'Curly', 'Moe'); foreach { print $_; } Demonstrate: Execute sum_list.pl script

Next lab assignment Perl Program Statement #!/usr/bin/perl #!/usr/bin/perl -w Print continuation statement print "error: incorrect number of arguments", "\n", "usage: intlist a b (where a < b)", "\n"; Demonstrate: Execute linenum.pl and intlist.pl scripts.

Next lab assignment Demonstrate Execute arry_sort.pl script Programming Perl text book reading Chapter One Chapter Two Chapter Three

Upcoming deadlines Advanced Shell Script, Lab Assignment 3-1 is due Jan. 29. Simple Perl Script, Lab Assignment 4-1 is due Feb. 5. Mid-term outline to be posted online on or before Jan. 30. Mid-term exam, (Lab Assignment 7-1) dates Feb Makefile Exercise, Lab Assignment 6-2 is due Feb. 19. Lab Assignment 6-1 is due Feb. 26

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