this script uses bash-isms