Sum of two numbers in bash script

Related image

හරි අපි පලෙවෙනි script එකෙන් කතා කලා කොහමද bash script එකක් use karala දෙයක් print කරන්නෙ කියල අද අපි බලමු කොහොමද arithmatic operatorse use කරන්නෙ කියල.
මම ඔයාලට කලින් post එකෙ කියල දුන්න විදියට bash script file එක හදාගන්න - https://binurayeshan.blogspot.com/2019/10/2.html
#!/bin/bash
num1=250 #value assign කරන විදිය
num2=500 #මතක තියාගන්න මෙ වගේම space තියන්නෙ නැතුව script එක ලියන්න
echo "number 1 = " $num1#number 1 එකේ value එක print කරන විදිය
echo "number 2 = " $num2
echo "number 1 + number 2 =" $[num1 + num2]#value දෙකක් එකතු කරන විදිය
ඊට පස්සෙ මේ Script file එකට permission දීලා Run කරන්න
chmod +x ex2.sh #මේ කියන්නෙ මේ file එකට executable permission දෙන්න කියල
./ex2.sh #දැන් ඔයාට මේ file එක run කරන්න පුලුවන්


Comments

Post a Comment

Popular posts from this blog

Lets talk about bash script

Logical Operators in bash script(And, OR, NOT)