Automation, Orchestration, and Scripting
A script splits a comma-separated line into three variables with read. Later commands in the same script depend on the default word splitting of unquoted variables. Which approach splits the line without disturbing those later commands?
Show the answer
Correct answerD. IFS=, read -r a b c <<< "$line"
Prefixing the assignment to read limits the changed IFS to that single command, so the shell's IFS stays at its default afterward. Setting IFS on its own line or exporting it changes it for the rest of the script, which breaks later word splitting.