OPS435 Quiz #3


Student Name: _____________________________________________


Multiple Choice / Multiple Answer / True or False


  1. Which of the following represents a valid test command? (Select all that apply)

    a) test $3 –eq 1 b) [ $# -eq 1 ] c) [ $# > 2 ] d) test $# < 6

  2. Which of the reserved words immediately follow the if statment?

    a) fi b) else c) then d) done

  3. The if statement can only be used with the test command.

    a) true b) false

  4. Which of the following symbols represents remainder in a math expression in Linux?

    a) + b) % c) / d) *

Walk-Through


    Write the standard output if the following shell script was run:


#!/bin/bash

num1=3;num2=7

echo -n "Result is:"

if [ $num2 -lt $num1 ]

then

echo "moo"

else

echo "you"

fi

echo "$num1/num2 - $((num1/num2))"

echo "done"


WRITE OUTPUT BELOW