help-bash
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Help-bash] Is there a way to allow `read` get empty field with IFS=


From: Grisha Levit
Subject: Re: [Help-bash] Is there a way to allow `read` get empty field with IFS=$'\t'?
Date: Sat, 10 Mar 2018 03:41:07 +0000

>
> 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')
>

Yup, that's exactly why I suggested the process substitution method instead
of here strings.

>


reply via email to

[Prev in Thread] Current Thread [Next in Thread]