title: How to take user input into an array and stop after a certain keyword?
body: <p>I want to take input from user(at run time) and store into an array until user enter, for example "q".
  I'm having problems while taking input. The closest working code I got so far is below:</p>
  
  <pre><code>while read inputs
  do
  array=("${array[@]}" $inputs)
  done
  echo User1 has:${array[0]}
  echo User2 has:${array[1]}
  echo User3 has:${array[2]}
  
  Output
  User1 has:123
  User2 has:asd
  User3 has:qw12
  </code></pre>
  
  <p>But the problem with this is I have to hit Ctrl+D (EOF) to tell there are no more input.There are other methods I've tried, most of them are erroneous</p>
  
  <pre><code>counter=1
  read array;
  for i in ${array[@]};do
  User$counter=$i
  echo User$counter
  done
  </code></pre>
  
  <p><strong>Is there any better way to take array input? Please help.</strong></p>