How 2>&1 and file descriptors works
sebastianmarines.com