title: How to split a string and store each split into variables
body: <pre><code>function check()
  {
      word=name@gmail.com
      arr=$(echo $word | tr "@" "\n")
  
      for x in $arr
      do
          echo "&gt; $x"
      done
  }
  </code></pre>
  
  <p>for output I get</p>
  
  <pre><code>name
  gmail.com
  </code></pre>
  
  <p>I want to store each of them into separate variables. How do I do that?</p>
  
  <p>Do I go</p>
  
  <pre><code>for x in $arr
  do
      echo "&gt; $x"
      first=$x
      second=$x
  done
  </code></pre>
  
  <p>Quite lost here. Help me out please!</p>