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

>> What the hell does `2>&1` even do?!

It redirects standard error to standard out? That's what it does in powershell anyway. Frex, I got this line in my $PROFILE:

  $p2 = & $env:Python_2/python.exe --version 2>&1
To get the current Python 2 version on my machine. I'm not really sure what it's an alias for, but I like having the shortcut of the more concise syntax.

The real problem is that, for some reason, python.exe --version outputs to standard _error_. That, I don't really get. I'm sure there's a good reason for it but it's not obvious and that's what's making the "2>&1" at the end hard to figure out.



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

Search: