Use /usr/bin/env instead of hard-coding paths

fixes #7789