How to add two numbers using command line arguments in Linux Shell Script | Linux Shell Script
Mar 08, 2022
LinuxShellScript,
3081 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"