Finished answering question. Slight modification to shell code