scripts: fix a lot of bashisms

Signed-off-by: Robert Nelson <robertcnelson@gmail.com>