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

I knew you could do that, but never knew you could do it with "|&" as a shorthand. TIL!

I found this comment in a bash documentation example to verify:

# To send stderr through a pipe, "|&" was added to Bash 4 as an abbreviation for "2>&1 |".



Fair warning - this is a bash-ism, so if you're writing a script that needs to run on multiple shells and/or a more primitive shell, you should avoid it.




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

Search: