1) Write a shell script called addtwo.sh to read in two numbers from the keyboar
ID: 3824414 • Letter: 1
Question
1) Write a shell script called addtwo.sh to read in two numbers from the keyboard and print their sum. The output should consist of a line showing the equation used to calculate the sum (e.g., 4 + 5 = 9).
[Hint: see read, echo and let].
2) Write a shell script called logincount.sh that given a person's UID (User ID), tells you how many times that person is logged on. The output line should print out something like “bschmidt is logged on 2 times.”
[Hint: see who, grep, and wc].
3) Write a shell script called lsdirs.sh that lists out, one line at a time, just the directories located in the current directory.
[Hint: see set, test, and looping].
Explanation / Answer
Answering only 1 question as multiple questions are asked
1.
echo "Enter two numbers"
read n1 n2
let sum=$n1+$n2
echo "The sum is = $sum"
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.