On Fri, Nov 24, 2017 at 11:22:56AM +0800, 尹剑虹 wrote:
> It's not the point. the problem is bash-4.4 auto add quote around  $var or 
> $(cmd)  after '<<<'
> 
> On bash-4.2 and before  following command always works fine
>   read ignore fstype <<<$(df --output=fstype $mountpoint)
> 
> But after Update bash-4.4, our customer's script get fail, do you understand 
> what I mean?

The script is broken.  It happened to work in bash 4.2 because of a bug
in bash 4.2 that cancelled out the bug in the script.

wooledg:~$ df --output=fstype /
Type
ext4

Here is how the script should be written:

{ read; read -r fstype; } < <(df --output=fstype "$mountpoint")

And testing it:

wooledg:~$ mountpoint=/
wooledg:~$ { read; read -r fstype; } < <(df --output=fstype "$mountpoint")
wooledg:~$ declare -p fstype
declare -- fstype="ext4"

Reply via email to