|
From: | Peng Yu |
Subject: | Re: [Help-bash] Is there a way to allow `read` get empty field with IFS=$'\t'? |
Date: | Fri, 9 Mar 2018 21:25:28 -0600 |
> $ mapfile -t -d $'\t' a < <(printf 'a\t\tb c\td') > $ declare -p a > declare -a a=([0]="a" [1]="" [2]="b c" [3]="d") The trailing newline is not removed but read -a does. Is there a way to remove the trailing newline with readarray? $ readarray -t -d $'\t' array <<< $'a\t\tb\tc' $ declare -p array declare -a array=([0]="a" [1]="" [2]="b" [3]=$'c\n') -- Regards, Peng
[Prev in Thread] | Current Thread | [Next in Thread] |