Is this `BASH_SOURCE` variable available in the `sh` shell? If it is bash specific, the script header should be changed to `#!/bin/bash`. Related to this, if I am not wrong the `-n` parameter in the `read` command is bash specific too.