Q1: write a shell script which can read "N" number of command line arguments and it should print the sum of those arguments. 10 20 30 e.g. ./myscript.sh Output: 60

A+ Guide To It Technical Support
10th Edition
ISBN:9780357108291
Author:ANDREWS, Jean.
Publisher:ANDREWS, Jean.
Chapter18: Macos, Linux, And Scripting
Section: Chapter Questions
Problem 12TC
icon
Related questions
Question

Only in shell command line

Q1: write a shell script which can read "N" number of command line
arguments and it should print the sum of those arguments.
e.g. ./myscript.sh 10 20 30
Output: 60
e.g. ./myscript.sh 10 5 4 2 1
Output: 22
Transcribed Image Text:Q1: write a shell script which can read "N" number of command line arguments and it should print the sum of those arguments. e.g. ./myscript.sh 10 20 30 Output: 60 e.g. ./myscript.sh 10 5 4 2 1 Output: 22
Expert Solution
steps

Step by step

Solved in 2 steps

Blurred answer
Knowledge Booster
Linux
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
A+ Guide To It Technical Support
A+ Guide To It Technical Support
Computer Science
ISBN:
9780357108291
Author:
ANDREWS, Jean.
Publisher:
Cengage,
LINUX+ AND LPIC-1 GDE.TO LINUX CERTIF.
LINUX+ AND LPIC-1 GDE.TO LINUX CERTIF.
Computer Science
ISBN:
9781337569798
Author:
ECKERT
Publisher:
CENGAGE L