cs2044_Lecture7

cs2044_Lecture7 - CS2044 Advanced Unix Tools Spring 2010...

Info iconThis preview shows pages 1–10. Sign up to view the full content.

View Full Document Right Arrow Icon
CS2044 - Advanced Unix Tools Spring 2010 Lecture 7 David Slater dms236 at cornell.edu March 8, 2010 David Slater dms236 at cornell.edu CS2044 - Advanced Unix Tools
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full Document Right Arrow Icon
Organization Homework 2 Due Monday March 14th Start Early! Turn In Code That Works! Follow Directions David Slater dms236 at cornell.edu CS2044 - Advanced Unix Tools
Background image of page 2
Lets talk about homework 1 Homework 1 (aka lets abuse uniq -c) David Slater dms236 at cornell.edu CS2044 - Advanced Unix Tools
Background image of page 3

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full Document Right Arrow Icon
A Grading Script #! /bin/bash rm histogram for f in "[email protected]" do echo "User: $f" echo "Grading Problem 1" bash $f/basichistogram.sh data Correct" || echo "Problem 1 Incorre c rm histogram echo echo "Grading Problem 2" bash $f/histogram.sh data ‘seq 0 2 100‘ t echo echo done rm histogram David Slater dms236 at cornell.edu CS2044 - Advanced Unix Tools
Background image of page 4
Random Bash Interaction Of The Day Previous Commands history - prints a list of previous commands - You can run commands using history, but. .. Ctrl-r - recursively search your history! Ctrl-r - again and again to go through matches David Slater dms236 at cornell.edu CS2044 - Advanced Unix Tools
Background image of page 5

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full Document Right Arrow Icon
Perl! Perl is an acronym, short for Practical Extraction and Report Language. It was designed by Larry Wall as a tool for writing programs in the UNIX environment. Why Perl? Perl has the power and flexibility of high level languages like C Like shell scripting, Perl does not require a special compiler and linker to use. This makes Perl ideal for producing quick solutions to small programming problems. Perl provides all the features of sed and awk plus features not found in either. In short, Perl is as powerful as C but as convenient as awk, sed and shell scripting. David Slater dms236 at cornell.edu CS2044 - Advanced Unix Tools
Background image of page 6
How to write Perl Scripts By convention, we will use the .pl extension for our perl scripts ( foo.pl ) To invoke the Perl interpreter we can type perl foo.pl Or we can start our script with the special character #! followed by where to find perl Perl is usually at /bin/perl (cygwin), /usr/bin/perl (ubuntu and csug machines) or /usr/bin/local/perl . We can also run perl commands directly by typing perl -e ’cmds’ . David Slater dms236 at cornell.edu CS2044 - Advanced Unix Tools
Background image of page 7

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full Document Right Arrow Icon
Baby Tiny Simple Silly Perl Scripts #! /usr/bin/perl # babyperl.pl $inputline = <STDIN>; print $inputline; $ ./babyperl.pl Here is my line of text Here is my line of text #! /usr/bin/perl # hello.pl print "Hello World!\n"; $ ./hello.pl Hello World! $ David Slater dms236 at cornell.edu CS2044 - Advanced Unix Tools
Background image of page 8
Perl Basics A Perl script is a sequence of statements (each statement is one task for the Perl interpreter to perform. Perl programming is
Background image of page 9

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full Document Right Arrow Icon
Image of page 10
This is the end of the preview. Sign up to access the rest of the document.

{[ snackBarMessage ]}

Page1 / 37

cs2044_Lecture7 - CS2044 Advanced Unix Tools Spring 2010...

This preview shows document pages 1 - 10. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online