Shell script to find sum of two numbers

DESCRIPTION:
  • This script will read two integer value from users and give output as sum of two values
SCRIPT:

    #!/bin/bash
   
    echo -n "Enter the first number : "
    read num1
    echo -n "Enter the second number : "
    read num2
    sum=`expr $num1 + $num2`
    echo "sum of two value is $sum"

RUN: 

    sh sum.sh

OUTPUT:

   Enter the first number : 23
   Enter the second number : 45
   sum of two value is 68


No comments:

Post a Comment