Hi,
I'm need to write a shell script that performs addition as much as the user requires using a while or an until loop but can only find "basic" addition script. Please help if you can.
Thanks/
Hi Dickiebird,
I work as an instructor for a telecom company and deliver a system administration course for a node based on a ufs and so this request came from one of my students. I don't do any scripting as part of the course - (it's mostly troubleshooting, backups & dumps )but have found a few basic calculating scripts in some unix text books but nothing with while or until...would I be right in assuming it's not a simple thing to do??
Thanks for your response anyway.
while :
do
print "Enter a number to add to total or 0 to quit \c"
read num
((total=$total + num))
if [ $num -eq 0 ]
then
exit
fi
print "\nRunning total is $total \n\n"
done
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.