I'm trying to assign multiple variables to load into a pipeline. I want to prompt the user for values and then read them into variables. My current script is:
echo "How many galaxies are you analyzing?"
read n1
i=1
while [$i -lt $n1]; do
echo "Please list galaxy $i."
read gal${i}
echo "How many observations are there for gal${i}?"
read n2
while [$j -lt $n2]
echo "Please enter observation #$j for gal${i}."
read obs${j}
echo gal${i}
echo obs${j}
let j++
done
echo gal${i}
let i+1
done
I would like for there to be a tree consisting of
├── gal1
| ├── obs1
│ └── obs2
├── gal2
│ ├── obs1
│ ├── obs2
│ └──obs3
where these values are any alphanumeric combination.
The error I'm getting when I run the loop above is:
user@user:~$ bash tst.tst
How many galaxies are you analyzing?
2
tst.ts: line 16: syntax error near unexpected token `done'
tst.ts: line 16: `done'