I have a text file. Using wc -l
I can determine their are 15 lines. I am trying to create a number of variables based on the output of wc -l
. So if I get 15 lines, I want 15 variables named var1 var2
and so on. Does anyone know a way to do this? The code I made seems to think i am doing a command, instead of varaible declaration. This is the following code
#!/bin/bash
VARIABLEAMT=$( wc -l myfile.txt )
NUMBER=0
while [ $NUMBER -le $VARIABLEAMT ];
do
var${NUMBER}=0
let NUMBER++
done
exit 0