Modify the addi command to loop until the user enters quit and to allow users to specify what function they want to apply to the pair of numbers given so that the following session would work.
$ addi
100 200
300
100 - 50
50
5 * 5
25
5/5
error: not enough arguments given
quit
$
#
# add pairs of integers on standard input
#
echo "> \c"
while read n1 n2 n3
do
if [ "$n1" = "quit" ] ; then
exit 0
fi
if [ -n "$n3" ] ; then
# we have three arguments if n3 is non-null
echo $(( $n1 $n2 $n3 ))
else
echo $(( $n1 + $n2))
fi
echo "> \c"
done
You might also like to view...
The default Equals implementation determines:
a) whether two references refer to the same object in memory. b) whether two references have the same type. c) whether two objects have the same instance variables. d) whether two objects have the same instance variable values.
The reference marker of _____ is a lowercase Roman numeral unless you change it.?
A. endnotes? B. ?margins C. ?page breaks D. ?bookmarks
Many Web sites include an area at the bottom of each page called the ____, which usually contains contact information and a copyright statement.
A. footer B. status C. base text D. header
What switch feature allows you to connect a network sniffer to a switch port and tells the switch to send a copy of frames seen on one port out the port to which your network sniffer is connected?
a. Port interception b. Port duplexing c. Port mirroring d. Port redirect