a shell script is a script (an interpreted program, so to say) for the shell, the right shell definition can be found on wikipedia; from your pov, the shell is just an interpreter for the script (normally a shell is interactive, it's the thing that "makes" the command line).
the script is clear text.
shell script can be used to run programs, do administrative tasks (like renaming files, moving files, deleting files, creating folders, killing tasks, finding files, dearchiving archives, and so on), and with the use of a proper program (as said, you can run any program through the shell) you can also connect, attack, download ... ...
a shell script can also be programmed so that it can work as a cgi script... briefly, a good shell like bash provides a real programming language taht can be used to do everything (or so)
the explanation of what's going on in your site is not clear. more likely the problem could be some PHP code that allowed an attacker to exploit your site, maybe injecting malicious files on your server? I can't know it! we need details to say more