s='id;some text here with possible ; inside'
IFS=';' read -r id string <<< "$s"
echo "$id"
restore.sh: 2: restore.sh: Syntax error: redirection unexpected
bash version GNU bash, version 4.2.37(1)-release (x86_64-pc-linux-gnu)
You seem to be using sh
to execute the script. Herestrings aren't supported in sh
; hence the error.
Ensure that you're using bash
to execute the script.