#!/bin/bash
declare -A matrix
declare -A matrixa
declare -A matrixaa
for((i=0;i<=1;i++)) do
for ((j=0;j<=1;j++)) do
read a
matrix[$i,$j]=$a
done
done

for((i=0;i<=1;i++)) do
for ((j=0;j<=1;j++)) do
read b
matrixa[$i,$j]=$b
done
done

for((i=0;i<=1;i++)) do
for((j=0;j<=1;j++)) do
d=${matrix[$i,$j]}
c=${matrixa[$i,$j]}
a=`expr $d + $c`
matrixaa[$i,$j]=$a
echo -ne ${matrixaa[$i,$j]} ” ”

done
echo
done

Leave a reply