script for http://unix.stackexchange.com/questions/172360/