bug-bash
[Top][All Lists]
Advanced

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

回复:[here string] uncompatible change on here string function


From: 尹剑虹
Subject: 回复:[here string] uncompatible change on here string function
Date: Tue, 28 Nov 2017 18:51:51 +0800 (GMT+08:00)

Thanks all.

Now I got it:
The point is the action on bash-4.2 and before deosn't match the action on ksh 
and zsh.

Jianhong

发自网易邮箱手机版


在2017年11月27日 23:42,Vladimir Marek 写道:
> > 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"

Or even
fstype=$( stat --file-system --print "%T\n" "$mountpoint" )

--
     Vlad

reply via email to

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