Improve shell prompt colorization code

Change code so it uses shell commands rather than using python.