Skip to main content
2 of 4
python uses colons, not the shell
ilkkachu
  • 147.9k
  • 16
  • 268
  • 441

If you are confident that the format of the file will always be "name\nnumber\n" then you could do:

cntr=0
cat answers.txt | while read line
do
    if [ $cntr -eq 0 ]
    then
      name=$line
      cntr=1
    elif [ $cntr -eq 1 ]
      number=$line
      echo "Your name is $name and your number is $number"
      cntr=0
    fi
done

This should print your statement until all name/number combinations have been read.

LJKims
  • 469
  • 4
  • 13