Unix HW 4
|
[Spring 2018] |
IFT 250: Shell & Script Programming with Unix |
Please submit via Blackboard by the due date
Part I: (4 * 5 = 20 pts)
Five (4) exercises from Chapter 13
Exercises 13.1, 13.2(i), 13.4, and 13.24 pp. 401-403
Part II: Increment and Precedence (1 * 5 = 5 pts)
You are encouraged to do this manually first, then run the script to verify your answers.
This is a preview of your exam question, so it is important you understand.
a=-2; b=3; c=5
ans = $((++a - b++ * ++c))
echo "ans1==$ans, a==$a, b==$b, c==$c;
Output 1 _______________________________________________
a=-2; b=3; c=5
(( ans2 = --a + ++b % c-- ))
echo "ans2==$ans2, a==$a, b==$b, c==$c"
Output 2 _______________________________________________
a=-2; b=3; c=5
ans3=$(( ++b / a-- * - ++c ))
echo "ans3==$ans3, a==$a, b==$b, c==$c"
Output 3 _______________________________________________
a=-1; b=0; c=2;
(( r4 = ++a && b-- || -c--))
echo "ans4== $r4, a== $a, b== $b, c== $c"
Output 4 _________________________________________
a=-1; b=0; c=2
(( r5 = -a-- && -++b || c--))
echo "ans5== $r5, a== $a, b== $b, c== $c"
Output 5 _________________________________________