Job control Dollar question mark and Conditionals
o A job is a program whose execution has been initiated by the usero exit code of the previous command is stored in the shell parameter $?
$ test -e file1
o At any moment, a job can be running or suspended
o Foreground job: $ echo $?
A program which has control of the terminal 0
$ test -d file1
o Background job: $ echo $?
Runs concurrently with the parent shell and does not take contr1l
of the keyboard $ cat announcers.test.txt
o Star a job in the background by appending & at the end of the call two ducks
Ex. ./joy & three squawking geese
o Commands: ^Z, jobs, fg, bg, kill
four Limerick oysters
o Ex. joy five corpulent porpoises
$ ls six pairs of Don Alversos tweezers
Week1-2-Shell.key giant mistake.sh 7,000 Macedonians in full battle array
shiftexample typescript announcers.test.txt eight brass monkeys from the ancient sacred crypts of
happy.c name small_file Egypt
argquotes joy overargs subs nine apathetic, sympathetic, diabetic old men on roller
$ ./joy with a marked propensity toward procrastination and
^C # this killed the job 10 lyrical, spherical, diabolical denizens of the deep
$ ./joy who hall
happyhappyhappyhappyhappyhappyhappyhappyhappyhappyhappy stall around the corner of the quo of the quay of the
happyhappyhappyhappyhappy^Z # this stopped the job quivery, all at
+ Stopped ./joy the same time.
$ jobs $ grep six announcers.test.txt
six pairs of Don Alversos tweezers
+ Stopped ./joy $ grep six announcers.test.txt > output
$ bg 1
+ ./joy & $ cat output
$ six pairs of Don Alversos tweezers
happyhappyhappyhappyhappyhappyhappyhappyhappyhappyhappy $ grep six announcers.test.txt
happyhappyhappyhappyhappyhappyhappyhappyhappyhappyhappy six pairs of Don Alversos tweezers
happyhappylshappyhappyhappy $ echo $?
Week1-2-Shell.key giant mistake.sh shiftexample 0
typescript $ grep seven announcers.test.txt
$ echo $?
announcers.test.txt happy.c name small_file 1
argquotes joy overargs subs
$ $ if grep seven announcers.test.txt # checks $? == 0