0

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]
0

2 Answers 2

1
#!/bin/sh
echo "enter the first number"
read a
echo "enter the seconf number"
read b
echo  $(($a+$b))
Sign up to request clarification or add additional context in comments.

1 Comment

0

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

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.