Sample Header Ad - 728x90

What's wrong with var=$(</dev/stdin) to read stdin into a variable?

48 votes
1 answer
13460 views
We've seen a few posts here lately that use this:
var=$(
in an attempt to read the shell's standard input into a variable. That is however not the correct way to do it on Linux-based systems and Cygwin at least. Why? What are the correct ways?
Asked by St&#233;phane Chazelas (579282 rep)
Sep 7, 2022, 08:22 AM
Last activity: Apr 11, 2025, 10:19 AM