Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to read from stdin with fish shell

Tags:

stdin

fish

With bash, we had the possibility to read multilines from stdin like this cat << END. When I try the same command from the fish shell, I get this error Expected a string, but instead found a redirection.

Is there a way to read from stdin with the fish shell ??!!

like image 443
Sidahmed Avatar asked Jul 16 '16 13:07

Sidahmed


1 Answers

"Heredocs", which are the feature you are referring to, are not in fish. This is because their main function is

cat <<END
some 
multiline 
string 
END

, which can be replicated by just using echo with a multiline literal, like

echo "some
multiline
string"

or printf "%s\n" with one argument per line, like

printf "%s\n" "some" "multiline" "string"
like image 136
faho Avatar answered Sep 28 '22 01:09

faho