samedi 3 décembre 2022

how to make a random matrix in bash in that program

#!/bin/bash

#How to make a random matrix in bash in that program, I don't understand how to make a random matrix in shell script.

#read the matrix order
read -p "Give rows and columns: " n

#accept elements
echo "Matrix element:"

let i=0
while [ $i -lt $n ]
do
let j=0
while [ $j -lt $n ]
do
read x[$(($n*$i+$j))]
j=$(($j+1))
done
i=$(($i+1))
done



Aucun commentaire:

Enregistrer un commentaire