However, even though i specify no password on the command, the script does not wait for a user input and just carries on regardless and errors out. What would be a better, generic way of doing this ...
Shell scripting is one of those skills that are absolutely invaluable on especially UNIX and BSD-based systems like the BSDs, the two zillion Linux distributions as well as MacOS. Yet not every shell ...