Doesn't handle pseudo-terminal names (/dev/pts/%d). Submitted by: Andrius Morkunas <kinokind@gmail.com>, Ed Schouten