fork download
  1. #!/bin/bash
  2.  
  3. read -ra arr
  4.  
  5. # first word
  6. firstWord="${arr[0]}"
  7.  
  8. # remove 1st word from array
  9. arr=("${arr[@]:1}")
  10.  
  11. # check output
  12. declare -p firstWord arr
Success #stdin #stdout 0s 19632KB
stdin
168820245 firstName LastName DateOfBirth
foo bar baz
xyz 123 999
stdout
declare -- firstWord="168820245"
declare -a arr=([0]="firstName" [1]="LastName" [2]="DateOfBirth")