如何使用 fish shell 读取标准输入

How to read from stdin with fish shell

使用 bash,我们可以像这样 cat << END 从 stdin 读取多行。当我从鱼 shell 尝试相同的命令时,出现此错误 Expected a string, but instead found a redirection.

有没有办法用鱼从 stdin 读取 shell ??!!

"Heredocs",也就是你所指的特征,不存在于鱼中。这是因为他们的主要功能是

cat <<END
some 
multiline 
string 
END

,只需将 echo 与多行文字一起使用即可复制,例如

echo "some
multiline
string"

printf "%s\n" 每行一个参数,如

printf "%s\n" "some" "multiline" "string"