========

#!/bin/bash

x=5 # initialize x to 5

y=3 # initialize y to 3

add=$(($x + $y)) # add the values of x and y and assign it to variable add

sub=$(($x - $y)) # subtract the values of x and y and assign it to variable sub

mul=$(($x * $y)) # multiply the values of x and y and assign it to variable mul

div=$(($x / $y)) # divide the values of x and y and assign it to variable div

mod=$(($x % $y)) # get the remainder of x / y and assign it to variable mod

========

try :)

Excellent blog :

ReplyDelete---

http://unstableme.blogspot.com/2009/01/insert-append-change-lines-using-sed.html

---

What do you do if x is smaller than y?

ReplyDeleteWhen I try instead of getting a decimal I get zero