Fixed script so it works on Ubuntu. Thanks @missinglink