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

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.