improve detecting PATH= without $PATH, update #1785
NEXT: [GH-1786] for 1.19.2