http://www.gnu.org/copyleft/gpl.html
Search for the source code of shell and start studying it.