我试图让bash处理从stdin传入的数据,但没有成功.我的意思是没有以下工作:
echo "hello world" | test=($(< /dev/stdin)); echo test=$test
test=
echo "hello world" | read test; echo test=$test
test=
echo "hello world" | test=`cat`; echo test=$test
test=
我希望输出为test=hello world
.我试着在"$test"
左右加上""引号,这也不管用.