Adding Two Numbers
In this challenge, you are tasked with creating a script to add two numbers, including real numbers. The script will use the bc
command and piping to perform the addition operation.
Tasks
You need to complete the following task:
- Write a script that asks the user to enter two numbers, allowing for real numbers as input.
- Use the
bc
command and piping to perform the addition operation.
Requirements
You must meet the following requirements:
- Script name:
add2No.sh
- Work directory:
~/project
Example
Sample Execution / Output:
labex:project/ $ bash add2No.sh
[INPUT] Enter the value of Number1 [INPUT]
12
[INPUT] Enter the value of Number2 [INPUT]
13
[INPUT] Enter the method to be used in Addition operation [INPUT]
1) method 1 uses expr command to add two numbers
2) method 2 uses bc (floating point is accepted) command to add two numbers
3) method 3 uses (( )) command to add two numbers
1
[OUTPUT] OPERATION PERFORMED
12+13 = 25