What's wrong with this piping in bash

Hi!
i’m trying to pipe an echo to three variables ,but all the values are assigned to the first variable only and the rest are empty , iv’e done this before so i don’t understand why its not working now

echo "$CHECK_USERS" | while read GAMES_PLAYED BAR BEST_GAME
do
  echo "Welcome back, $USERNAME! You have played $GAMES_PLAYED games, and your best game took $BEST_GAME guesses."
  echo "Guess the secret number between 1 and 1000:"
  read GUSSED_NUM
done

the output is : ( Welcome back, k! You have played 1|8 games, and your best game took guesses. )

i’ve checked $GAMES_PLAYED and it’s value is ( 1|8 ) $BAR and $BEST_GAME are empty .

I believe you have to separate it with spaces: 1|8 should be 1 | 8

The easiest way is to pipe it into a sed and use regex before you pipe it into a new variable… try something like

echo "$CHECK_USERS" | sed 's/|/ | /g' | while read GAMES_PLAYED BAR BEST_GAME

I hope that works!