Shell Script To Add Two Numbers Using Command Line Arguments - The Coding Shala
Home >> Scripting >> Add two numbers
Shell Script To Add Two Numbers Using Command Line Arguments
Write a shell script to add two numbers supplied as a command-line argument?
Code:
#!/bin/bash if [ $# -ne 2 ] then echo "enter two arguments" else sum=$(echo "$1 + $2" | bc) echo "$sum " fi
Other Posts You May Like
Comments
Post a Comment