[Top][All Lists]

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

Re: [Help-bash] Why `$(<` is slow?

From: Stephane Chazelas
Subject: Re: [Help-bash] Why `$(<` is slow?
Date: Fri, 30 Aug 2019 18:23:58 +0100
User-agent: NeoMutt/20171215

2019-08-30 11:58:26 -0500, Peng Yu:
> > Note that IFS= read -rd '' x (you forgot the IFS= btw)
> What is the difference between `IFS= read -r -d '' x` and `read -r -d
> '' x`? I can not make an example to show the difference. Do you have
> an example? Thanks.

See for instance


$ printf '\n \tqwe\n \t\0' | bash -c 'read -rd "" x; printf "<%q>\n" "$x"'
$ printf '\n \tqwe\n \t\0' | bash -c 'IFS= read -rd "" x; printf "<%q>\n" "$x"'
<$'\n \tqwe\n \t'>

See also:

$ printf 'foo:' | bash -c 'IFS=:; read -rd "" x; printf "<%q>\n" "$x"'
$ printf 'foo:' | bash -c 'IFS=:; IFS= read -rd "" x; printf "<%q>\n" "$x"'


reply via email to

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