Week Five Agenda Link of the week Review week four lab assignment This week’s expected outcomes...

Post on 17-Jan-2018

213 views 0 download

description

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

Transcript of Week Five Agenda Link of the week Review week four lab assignment This week’s expected outcomes...

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 • http://www.ontrackdatarecovery• http://hp.com.au/setlTfree/connectData 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 MonkeyDefine: Thermal Logic Technology

Review week four lab assignment• Shell Commands

catchmodcpdatefindgrepmkdirmorelessrmdirrmsortsleepwc killdiffcdwhence 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 statementsprintf “string” - output a string of informationecho $COUNTER - output content of the variable COUNTERprintf $NUMBER - output content of the variable NUMBERNUMBER=$(($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 Syntaxwhile [ … ]do

…doneif [ … ]then

…fiif [ … ]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 Operatorseq - equalne - not equallt - less thangt - greater thanle - less than or equalge - greater than or equalcmp - 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 Commandschopunlessprint $varpop

Review week four lab assignment

• Perl Variable Syntax$ singular variables prefix (single value, number or string)@ 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 \n new line

Weeks four and five expected outcomes

• Write Perl scripts, including variables, control flow, and regular expression syntax

Next lab assignmentProgramming Perl, Chapter 32 Standard ModulesDefine: ModuleParsing the command line with Getopt::StdExample: listdir –l –n –a 10:00 bottom topPerl utilizes @ARGV to capture the command line

argumentsExample: $ARGV[0] ‘-l’

$ARGV[1] ‘-n’ $ARGV[2] ‘-a’ $ARGV[3] ’10:00’ $ARGV[4] ‘bottom’ $ARGV[5] ‘top’

Next lab assignment

• Perl Array@garage = (“rake”, “mower”, “shovel”);($rake, $mower, $shovel) = @garage

• 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 emailed at the end of the week.

• Reading AssignmentEssential System Administration

Chapter One, pages 1 -8, 12 – 28Chapter Two, pages 32 – 61Chapter Three

Programming PerlChapter OneChapter Two, pages 47 – 65, 69 – 73, 76 - 83 Chapter Three, pages 86 – 90, 92 -101Chapter Thirty Two, pages 865 – 867, 899

Questions and answers• Questions• Comments• Concerns

• After class I will help students with their scripts.