Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

If the shell were to treat cat as a builtin, could it implement cat| as a stdin redirect?

I wish I could write "useless cat" without people pestering me about it.



Bash allows the $(< file) syntax instead of $(cat file), and I think the latter might be converted to the former.


It's built-in in Zsh: The substitution ‘$(cat foo)’ may be replaced by the faster ‘$(<foo)’.

https://zsh.sourceforge.io/Doc/Release/Expansion.html#Comman...


Is that only for command substitution?


What do you mean? It's specifically for $(cat …) / $(< …): the latter is a faster equivalent of the former. Other than that, see my comment about $READNULLCMD.




Consider applying for YC's Summer 2026 batch! Applications are open till May 4

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: