Q. How do I write Bash Script to add two numbers using function
Ans:
#!/bin/bash #function to add two numbers add() { x=$1 y=$2 echo -e "Number entered by u are: $x and $y" echo "sum of $1 and $2 is `expr $x + $y` " } # main script echo "enter first number" read first echo "enter second number" read sec #calling function add $first $sec echo "end of the script"
Output
Enjoy :)
If You Liked This Post Please Take a Time To Share This Post
Thnx its gud who want to learn shell schripting as well as programming basics
ReplyDeletehave read your blog its very attractive and impressive. I like it your blog.
ReplyDeletePHP 7 Training in chennai | PHP 7 Training Course
PHP 7 Training in chennai | Online PHP 7 Course
This is a nice article here with some useful tips for those who are not used-to comment that frequently. Thanks for this helpful information I agree with all points you have given to us. I will follow all of them.
ReplyDeletepython course in pune
python course in chennai
python Training in Bangalore
That was a great message in my carrier, and It's wonderful commands like mind relaxes with understand words of knowledge by information's.
ReplyDeleteData Science course in Chennai
Data science course in bangalore
Data science course in pune
Data science online course
Data Science Interview questions and answers
Data Science Tutorial
Very nice post here and thanks for it .I always like and such a super contents of these post.Excellent and very cool idea and great content of different kinds of the valuable information's.
ReplyDeleterpa training in bangalore
best rpa training in bangalore
rpa training in pune | rpa course in bangalore
rpa training in chennai
Happy to read the informative blog. Thanks for sharing
ReplyDeletebest java training institute in chennai
best java training institute in chennai
This post is so interactive and informative.keep update more information...
ReplyDeleteAndroid Training in Anna Nagar
Android Training in Chennai
This post is so interactive and informative.keep update more information...
ReplyDeleteDevOps course in Tambaram
DevOps Training in Chennai
Thank you for sharing this insightful content. I always appreciate reading such high-quality information. The presented ideas are truly outstanding and captivating, making the post a delight to explore. Your fantastic work is commendable – keep it up.
ReplyDeletevisit: Getting To Know Test Automation: Navigating Tools And Frameworks For Software Testing Excellence
Thanks admin for sharing this I like this.If you want to know about Java so you can visit: Java Performance Tuning: Optimizing Your Code for Speed
ReplyDeletegreat post, impressive , the way you explain shell-script-to-add-two-numbers-by-use is hats off , no doubt getting high demands in IT is java , and your looking for it then visit java course in pune , thanks for this valuable post
ReplyDeleteThank you for sharing. I always appreciate engaging content with valuable insights. The presented ideas are exceptional and innovative, making the post truly enjoyable. Keep up the fantastic work.
ReplyDeleteVisit site: Data Magic: Python's Role In The Age Of Analytics
Informative post. Thank you sharing. Please visit our website to learn new courses.
ReplyDelete