I know it is basic question but i am unable to write simple addition program in unix. i am using cygwin to write the shell script my script is this
#!/bin/sh
echo "enter the first number"
read a
echo "enter the seconf number"
read b
echo [$a + $b]
I know it is basic question but i am unable to write simple addition program in unix. i am using cygwin to write the shell script my script is this
#!/bin/sh
echo "enter the first number"
read a
echo "enter the seconf number"
read b
echo [$a + $b]
#!/bin/sh
echo "enter the first number"
read a
echo "enter the seconf number"
read b
echo $(($a+$b))
To add two numbers, you can do this:
let c = $a + $b
echo $c
To read, you can do:
read -p "Enter the first number" a
read -p "Enter the second number" b