How to parse commands and color it?

563 views Asked by At

I like the idea of command prompt coloring, and I was wondering how I can extend that to have the shell color the commands as I type it in or via tab completion. So for example, when I finish typing 'gcc', the shell should recognize that it is a valid command and color it green. If the command is not a recognized command then it should be colored in red and boldfaced.

This feature will help tremendously in typing in correct commands especially if you have long commandlines with pipelined commands which accidentally contain a typo. All command typos will be colored red and boldfaced so that I can easily identify which command I typed incorrectly.

1

There are 1 answers

1
Igor Chubin On BEST ANSWER

I'm not sure that you can do this in bash. But it is possible in other shells, e.g. in zsh (see: https://github.com/zsh-users/zsh-syntax-highlighting ) or in fish (see: http://fishshell.com/ ).