bash 4.3 lastpipe bug or feature?

Viewed 1205

I try to use the lastpipe option in the bash and it seems to not work as expected when run from the interactive prompt command line.

phi@phiz:~$ shopt lastpipe
lastpipe        on

phi@phiz:~$ echo $BASH_VERSION
4.3.11(1)-release

phi@phiz:~$ echo yo | read a ; echo "a='$a'"
a=''

So I don't get anything in $a, yet if run in a sub process it kinda works though useless I need it in the top level interactive

phi@phiz:~$ (echo yo | read a ; echo "a='$a'")
a='yo'

Is this behavior expected? I did my RTFM duties and could not decide if this was intended or unexpected.

I am new to bash and this confusing when coming from other shells

Thanks in advance for any advices.

1 Answers
Related