Mistakenly modified `/bin/sh'
In Ubuntu systems, /bin/sh
is a symbolic link to the dash
shell by default:
$ ls -l /bin/sh
lrwxrwxrwx 1 root root 4 Jul 7 2018 /bin/sh -> dash
So (assuming your terminal emulator uses the bash shell, and didn't get broken by your mistake) all you need to do is re-create the link:
sudo ln -sf dash /bin/sh
No, you don't have to reinstall your system. /bin/sh is only a softlink to your shell. readlink -f /bin/sh /bin/bash
In my case bash. Move your script and make a softlink to your favorite shell.