Lec08 - Lecture 8 Bourne shell scripting(I Have you started HW3 yet Exit status Every command run returns an exit status 0 = success Anything else

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

View Full Document Right Arrow Icon
Lecture 8: Bourne shell scripting (I) Have you started HW3 yet?
Background image of page 1

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

View Full DocumentRight Arrow Icon
Exit status Every command run returns an exit status 0 = success Anything else = failed, somehow $? = exit status of last command grep -q – doesn't print anything Only useful for exit status What if grep didn't have -q ? Argument to Java's System.exit C's return from main()
Background image of page 2
Signals What kill really does: Send a “signal” to a process or job Default = SIGTERM (TERMinate; please quit) 9 = SIGKILL (KILL; extreme prejudice) CTRL-C = SIGINT (INTerrupt) yes > /dev/null (CTRL-C) $? = 130 = 128 + 2; 2 = SIGINT yes > /dev/null; kill -9 $? = 137 = 128 + 9; 9 = SIGKILL
Background image of page 3

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

View Full DocumentRight Arrow Icon
Using exit status; if/else if grep -q purple colors then echo found purple else echo did not find it fi Newlines are important!
Background image of page 4
if command1 then command2 elif command3 then command4 ... else
Background image of page 5

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

View Full DocumentRight Arrow Icon
Image of page 6
This is the end of the preview. Sign up to access the rest of the document.

This note was uploaded on 03/04/2008 for the course CS 2110 taught by Professor Francis during the Spring '07 term at Cornell University (Engineering School).

Page1 / 12

Lec08 - Lecture 8 Bourne shell scripting(I Have you started HW3 yet Exit status Every command run returns an exit status 0 = success Anything else

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

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