Question: Write a Bash script that computes the sum of the absolute values of integers given by standard input. The numbers are given in a single
Write a Bash script that computes the sum of the absolute values of integers given by standard input. The numbers are given in a single line, separated by a space. You should print the sum of their absolute values to standard output. For example, given the input: 2 41 -15 the script should print to the standard output: 58 as the absolute values of the numbers in the input are 2, 41 and 15, and their sum is 58. Assume that: The sum of absolute values of the input does not exceed 1018; The machine is running Ubuntu 16.04.
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
