Loading, please wait...

A to Z Full Forms and Acronyms

How to add two numbers using command line arguments in Linux Shell Script | Linux Shell Script

Mar 08, 2022 LinuxShellScript, 3078 Views
How to add two numbers using command line arguments in Linux Shell Script | Linux Shell Script

How to add two numbers using command line arguments in Linux Shell Script | Linux Shell Script

We will create a shell script program to add two numbers that will be passed on the command line with the program name.

#!/bin/bash
# Program name: "command_line_add.sh"

sum=`expr $1 + $2`
echo "Sum is: $sum"
A to Z Full Forms and Acronyms