mirror of
https://https.git.savannah.gnu.org/git/bash.git
synced 2026-06-21 12:57:58 +02:00
18 lines
459 B
Plaintext
18 lines
459 B
Plaintext
# the read builtin uses a consistent value of IFS to split the input line
|
|
# into fields
|
|
|
|
IFS=:
|
|
INPUT=',:abc:def,ghi'
|
|
read -r IFS var rest <<<"$INPUT"
|
|
printf 'IFS=[%s] var=[%s] rest=[%s]\n' "$IFS" "$var" "$rest"
|
|
|
|
IFS=:
|
|
INPUT=':abc:def,ghi'
|
|
read -r IFS var rest <<<"$INPUT"
|
|
printf 'IFS=[%s] var=[%s] rest=[%s]\n' "$IFS" "$var" "$rest"
|
|
|
|
IFS=:
|
|
INPUT=' : abc:def,ghi '
|
|
read -r IFS var rest <<<"$INPUT"
|
|
printf 'IFS=[%s] var=[%s] rest=[%s]\n' "$IFS" "$var" "$rest"
|