Fix for 29a9bca5c: Commit introduced non POSIX (bash only) commands

The commit 29a9bca5c74d7305e81e0144b0252bf619a0bb6a does not work under
a POSIX shell like dash (Debian/Ubuntu). This code fixes the problem
and makes the script POSIX compliant.
Merge pull request #112 from dol/hotfix/posix-fix-for-debian

Fix for 29a9bca5c: Commit introduced non POSIX (bash only) commands and breaks on Debian (dash=/bin/sh)